package com.zhuiyun.project.api.lottery.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson2.JSON;
import com.zhuiyun.project.api.lottery.entity.Args;
import com.zhuiyun.project.api.lottery.entity.Lottery;
import com.zhuiyun.project.api.lottery.entity.PLSResult;
import com.zhuiyun.project.api.lottery.mapper.LotteryMapper;
import com.zhuiyun.project.api.lottery.model.LotteryModel;
import com.zhuiyun.project.api.lottery.service.LotteryService;
import com.zhuiyun.project.api.lottery.task.AsyncLotteryData;
import com.zhuiyun.project.util.ObjectUtils;
import com.zhuiyun.project.util.RedisUtil;
import com.zhuiyun.project.util.constants.CommonConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;

/**
 * @ClassName LotteryServiceImpl
 * @Description TODO
 * @Author 17179
 * @Date 2024/7/16 15:49
 **/
@Service
public class LotteryServiceImpl implements LotteryService {

    @Autowired
    LotteryMapper lotteryMapper;
    @Autowired
    AsyncLotteryData asyncLotteryData;

    /**
     * 批量新增 去重重复数据
     * @param lotteryList
     */
    @Override
    public int saveListLottery(List<Lottery> lotteryList) {
      return   lotteryMapper.insertIgnoreBatch(lotteryList);
    }
    /**
     * 查询数据总条数
     * @return
     */
    @Override
    public int selectLotteryCount(String type) {
        int c = lotteryMapper.selectLotteryCount(type);
        return c;
    }

    /**
     * 设置请求的参数
     * @param args
     */
    public void setCount(Args args){
        if(args.getCount() != 0){
            args.setCount(args.getCount()+5);
        }else if(args.getFirst()!=0&&args.getSecond()!=0){
            args.setFirst(args.getFirst()-5);
        }else{
            args.setCount(105);
        }
    }
    /**
     * 获取百位1的数据
     * @return
     */
    @Override
    public PLSResult getHundredOne(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
  //      RedisUtil.set(CommonConstants.PLS,list,60*60*24);
        List dateNum = null;
        List data = null;
        int  colNum = 0; //列数
        // 为了计算跨度必须提供105期数据
        int buttonIndex = 0;
        switch (args.getOption()){
            case 3:
                buttonIndex = 0;
                break;
            case 1:
                buttonIndex = 1;
                break;
            case 2:
                buttonIndex = 2;
                break;
        }
        if(ObjectUtils.isNotEmpty(list)){
            // 自组号码
            HashMap<String,String> h = new HashMap<>();
            h.put("0","4961549615");
            h.put("1","6072760727");
            h.put("2","1194811948");
            h.put("3","8855488554");
            h.put("4","3216932169");
            h.put("5","9387693876");
            h.put("6","5428054280");
            h.put("7","0509105091");
            h.put("8","7633276332");
            h.put("9","2740327403");

            dateNum = new ArrayList();
            data = new ArrayList();
            // 这两个值是用来获取前两期中的数使用的
            int threeIndex = 0;
            int twoIndex = 0;
            LotteryModel lotteryModel = list.get(2);
            String substring = lotteryModel.getLotteryNo().substring(2);
            //  起始位公式为   ((期数-5)%5)  6 11 16 0 = 6    6- x/5
            int va =  ((Integer.parseInt(substring)-5))%5;
            int startIndex = 0;
            if(va == 0){
                startIndex = 1;
            }else{
                startIndex = 6-va;
            }
            startIndex = startIndex+args.getHundredOne(); // 这里计算得是百位 1 2 3 4 5
            if(startIndex==8){
                startIndex = 3;
            }
            if(startIndex==9){
                startIndex = 4;
            }
            for (int i=2;i<list.size();i++){
                threeIndex = i-2;
                twoIndex = i-1;
                LotteryModel lotteryThree = list.get(threeIndex);
                LotteryModel lotteryTwo = list.get(twoIndex);
                LotteryModel lotteryOne = list.get(i);
                // 通过彩票第一位数 获取自组号码中的数据
                String  three = lotteryThree.getLotteryRes().split(",")[buttonIndex];
                String  two = lotteryTwo.getLotteryRes().split(",")[buttonIndex];
                String one = lotteryOne.getLotteryRes().split(",")[buttonIndex];
                String threeNum = h.get(three);
                String twoNum = h.get(two);
                String oneNum = h.get(one);
                if(startIndex == 0){
                    startIndex = 5;
                }
                char oneChar = oneNum.charAt(startIndex);
                char twoChar = twoNum.charAt(startIndex+1);
                char threeChar = threeNum.charAt(startIndex+2);
                startIndex--;
                // 拼接计算结果
                String dataStr =oneChar +""+twoChar+threeChar;
                if(args.getTypeFlag() == 1){
                    data.add(oneNum);
                }else{
                    data.add(dataStr);
                }
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryOne.getLotteryDate()+"-"+lotteryOne.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);
                colNum = startIndex;

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        // 将结果返回前端
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);
        plsResult.setColNum(colNum);
        return plsResult;
    }

    @Override
    public List<Map> getLotteryNo(String type) {
        Object o = RedisUtil.get(CommonConstants.NUM+type);
        List<Map> lotteryNo = null;
        if(!ObjectUtils.isNotEmpty(o)){
            lotteryNo = lotteryMapper.getLotteryNo(type);
            RedisUtil.set(CommonConstants.NUM+type,lotteryNo,60*60*24);
        }else{
            lotteryNo =  (List<Map>)o;
        }
        List<Map> maps = null;
        if(lotteryNo.size()>5){
              maps = lotteryNo.subList(5, lotteryNo.size());
        }else{
            RedisUtil.del(CommonConstants.NUM+type);
        }
       return maps;
    }

    @Override
    public PLSResult hundredOTSTF(Args args) {
        List<LotteryModel> list = null;
        if(args.getCount() != 0){
            args.setCount(args.getCount()+3);
        }else if(args.getFirst()!=0&&args.getSecond()!=0){
            args.setFirst(args.getFirst()-3);
        }else{
            args.setCount(103);
        }
        list = lotteryMapper.select105data(args);
        List dateNum = null;
        List data = null;
        int  colNum = 0; //列数
        // 为了计算跨度必须提供105期数据
        if(ObjectUtils.isNotEmpty(list)){
            // 自组号码
            HashMap<String,String> h = new HashMap<>();
            h.put("0","4961549615");
            h.put("1","6072760727");
            h.put("2","1194811948");
            h.put("3","8855488554");
            h.put("4","3216932169");
            h.put("5","9387693876");
            h.put("6","5428054280");
            h.put("7","0509105091");
            h.put("8","7633276332");
            h.put("9","2740327403");
            dateNum = new ArrayList();
            data = new ArrayList();
            // 这两个值是用来获取前两期中的数使用的
            int threeIndex = 0;
            int twoIndex = 0;
            LotteryModel lotteryModel = list.get(0);
            String substring = lotteryModel.getLotteryNo().substring(2);
            //  起始位公式为   ((期数-5)%5)  6 11 16 0 = 6    6- x/5
            int va =  ((Integer.parseInt(substring)-5))%5;
            int startIndex = 0;
            if(va == 0){
                startIndex = 1;
            }else{
                startIndex = 6-va;
            }
            startIndex = startIndex+args.getHundredOne(); // 这里计算得是百位 1 2 3 4 5
            if(startIndex==8){
                startIndex = 3;
            }
            if(startIndex==9){
                startIndex = 4;
            }
            for (int i=0;i<list.size();i++){
                LotteryModel lotteryOne = list.get(i);
                // 通过彩票第一位数 获取自组号码中的数据
                String one = lotteryOne.getLotteryRes().split(",")[0];
                String oneNum = h.get(one);
                if(startIndex == 0){
                    startIndex = 5;
                }
                startIndex--;
                // 拼接计算结果
                data.add(oneNum);
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
              //  String dateStr = lotteryOne.getLotteryDate()+"-"+lotteryOne.getLotteryNo().substring(2)+"-"+dataStr;
               // dateNum.add(dateStr);
                colNum = startIndex;

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        // 将结果返回前端
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);
        plsResult.setColNum(colNum);
        return plsResult;
    }

    @Override
    public String getLastLotteryNo(String type) {
        String lastLotteryNo = lotteryMapper.getLastLotteryNo(type);
        if(!ObjectUtils.isNotEmpty(lastLotteryNo)){
            lastLotteryNo = "";
        }
        return lastLotteryNo;
    }

    @Override
    public String getLastLotteryRes(String type) {
        String lastLotteryRes = lotteryMapper.getLastLotteryRes(type);
        if(!ObjectUtils.isNotEmpty(lastLotteryRes)){
            lastLotteryRes = "";
        }
        return lastLotteryRes;
    }

    /**
     * 彩票得类型  百位 \ 12345
     * @param args
     * @return
     */
    @Override
    public PLSResult getHundredOneReverse(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        List dateNum = null;
        List data = null;
        int  colNum = 0; //列数
        // 为了计算跨度必须提供105期数据
        int buttonIndex = 0;
        switch (args.getOption()){
            case 4:
                buttonIndex = 0;
                break;
            case 5:
                buttonIndex = 1;
                break;
            case 6:
                buttonIndex = 2;
                break;
        }
        if(ObjectUtils.isNotEmpty(list)){
            // 自组号码
            HashMap<String,String> h = new HashMap<>();
            h.put("0","4961549615");
            h.put("1","6072760727");
            h.put("2","1194811948");
            h.put("3","8855488554");
            h.put("4","3216932169");
            h.put("5","9387693876");
            h.put("6","5428054280");
            h.put("7","0509105091");
            h.put("8","7633276332");
            h.put("9","2740327403");

            dateNum = new ArrayList();
            data = new ArrayList();
            // 这两个值是用来获取前两期中的数使用的
            int threeIndex = 0;
            int twoIndex = 0;
            LotteryModel lotteryModel = list.get(2);
            String substring = lotteryModel.getLotteryNo().substring(2);
            //  起始位公式为   ((期数-5)%5)  6 11 16 0 = 6    6- x/5
            int va =  ((Integer.parseInt(substring)-5))%5;
            int startIndex = 0;
            if(va == 0){
                startIndex = 1;
            }else{
                startIndex = 9-(6-va);
            }
            startIndex = startIndex+args.getHundredOne(); // 这里计算得是百位 1 2 3 4 5
            if(startIndex>=10){
                startIndex = (startIndex-9)+4;
            }
            if(startIndex==0){
                startIndex = 5;
            }
            if(startIndex==1){
                startIndex = 6;
            }
            for (int i=2;i<list.size();i++){
                threeIndex = i-2;
                twoIndex = i-1;
                LotteryModel lotteryThree = list.get(threeIndex);
                LotteryModel lotteryTwo = list.get(twoIndex);
                LotteryModel lotteryOne = list.get(i);
                // 通过彩票第一位数 获取自组号码中的数据
                String  three = lotteryThree.getLotteryRes().split(",")[buttonIndex];
                String  two = lotteryTwo.getLotteryRes().split(",")[buttonIndex];
                String one = lotteryOne.getLotteryRes().split(",")[buttonIndex];
                String threeNum = h.get(three);
                String twoNum = h.get(two);
                String oneNum = h.get(one);
                if(startIndex == 9){
                    startIndex = 4;
                }
                char oneChar = oneNum.charAt(startIndex);
                char twoChar = twoNum.charAt(startIndex-1);
                char threeChar = threeNum.charAt(startIndex-2);
                startIndex++;
                // 拼接计算结果
                String dataStr = threeChar+""+twoChar+oneChar;
                if(args.getTypeFlag() == 1){
                    data.add(oneNum);
                }else{
                    data.add(dataStr);
                }
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryOne.getLotteryDate()+"-"+lotteryOne.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);
                colNum = startIndex;

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        // 将结果返回前端
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);
        plsResult.setColNum(colNum);
        return plsResult;
    }

    /**
     * @Author 李中博、张博童
     * @Description
     * @Date 2024/9/18 15:52
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param args 百位十位个位  按钮 数列数据组合
     */
    @Override
    public PLSResult getLotteryHTP(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        List data = null;
        List dateNum=null;
        int  colNum = 0; //列数
        if(ObjectUtils.isNotEmpty(list)){
            data = new ArrayList();
            dateNum = new ArrayList();
            for (int i=2;i<list.size();i++){
                LotteryModel lotteryModel = list.get(i);
                String lotteryRes = lotteryModel.getLotteryRes();
                String result = lotteryRes.replace(",", "");
                // 拼接计算结果
                String dataStr =result.substring(0,3);
                data.add(dataStr);
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryModel.getLotteryDate()+"-"+lotteryModel.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setColNum(colNum);
        plsResult.setDateNumData(dateNum);

        return plsResult;
    }
    /**
     * 获取/百十差、/十个差、/百个差的数据
     * @return
     */
    @Override
    public PLSResult getHundredTenDifference(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        //      RedisUtil.set(CommonConstants.PLS,list,60*60*24);
        List dateNum = null;
        List data = null;
        int  colNum = 0; //列数
        // 为了计算跨度必须提供105期数据
        int buttonIndex = 0;
        switch (args.getOption()){
            case 8:
                buttonIndex = 0;
                break;
            case 9:
                buttonIndex = 1;
                break;
            case 10:
                buttonIndex = 2;
                break;
        }
        if(ObjectUtils.isNotEmpty(list)){
            // 自组号码
            HashMap<String,String> h = new HashMap<>();
            h.put("0","4961549615");
            h.put("1","6072760727");
            h.put("2","1194811948");
            h.put("3","8855488554");
            h.put("4","3216932169");
            h.put("5","9387693876");
            h.put("6","5428054280");
            h.put("7","0509105091");
            h.put("8","7633276332");
            h.put("9","2740327403");

            dateNum = new ArrayList();
            data = new ArrayList();
            // 这两个值是用来获取前两期中的数使用的
            int threeIndex = 0;
            int twoIndex = 0;
            LotteryModel lotteryModel = list.get(2);
            String substring = lotteryModel.getLotteryNo().substring(2);
            //  起始位公式为   ((期数-5)%5)  6 11 16 0 = 6    6- x/5
            int va =  ((Integer.parseInt(substring)-5))%5;
            int startIndex = 0;
            if(va == 0){
                startIndex = 1;
            }else{
                startIndex = 6-va;
            }
            startIndex = startIndex+args.getHundredOne(); // 这里计算得是百位 1 2 3 4 5
            if(startIndex==8){
                startIndex = 3;
            }
            if(startIndex==9){
                startIndex = 4;
            }
            for (int i=2;i<list.size();i++){
                threeIndex = i-2;
                twoIndex = i-1;
                LotteryModel lotteryThree = list.get(threeIndex);
                LotteryModel lotteryTwo = list.get(twoIndex);
                LotteryModel lotteryOne = list.get(i);

                //根据当期的彩票结果 求出百十差，十个差，百个差祖成的数组（绝对值） /12345
                String[] threeArray = getDifferenceStringArray(lotteryThree.getLotteryRes().split(","));
                String[] twoArray = getDifferenceStringArray(lotteryTwo.getLotteryRes().split(","));
                String[] oneArray = getDifferenceStringArray(lotteryOne.getLotteryRes().split(","));
                // 通过所传下标获得 0百十差 1十个差 2百个差 获取自组号码中的数据
                String  three = threeArray[buttonIndex];
                String  two = twoArray[buttonIndex];
                String one = oneArray[buttonIndex];

                String threeNum = h.get(three);
                String twoNum = h.get(two);
                String oneNum = h.get(one);
                if(startIndex == 0){
                    startIndex = 5;
                }
                char oneChar = oneNum.charAt(startIndex);
                char twoChar = twoNum.charAt(startIndex+1);
                char threeChar = threeNum.charAt(startIndex+2);
                startIndex--;
                // 拼接计算结果
                String dataStr =oneChar +""+twoChar+threeChar;
                if(args.getTypeFlag() == 1){
                    data.add(oneNum);
                }else{
                    data.add(dataStr);
                }
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryOne.getLotteryDate()+"-"+lotteryOne.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);
                colNum = startIndex;

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        // 将结果返回前端
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);
        plsResult.setColNum(colNum);
        return plsResult;
    }
    /**
     * 获取/百十和、/十个和、/百个和的数据
     * @return
     */
    @Override
    public PLSResult getHundredTenSum(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        //      RedisUtil.set(CommonConstants.PLS,list,60*60*24);
        List dateNum = null;
        List data = null;
        int  colNum = 0; //列数
        // 为了计算跨度必须提供105期数据
        int buttonIndex = 0;
        switch (args.getOption()){
            case 16:
                buttonIndex = 0;
                break;
            case 17:
                buttonIndex = 1;
                break;
            case 18:
                buttonIndex = 2;
                break;
        }
        if(ObjectUtils.isNotEmpty(list)){
            // 自组号码
            HashMap<String,String> h = new HashMap<>();
            h.put("0","4961549615");
            h.put("1","6072760727");
            h.put("2","1194811948");
            h.put("3","8855488554");
            h.put("4","3216932169");
            h.put("5","9387693876");
            h.put("6","5428054280");
            h.put("7","0509105091");
            h.put("8","7633276332");
            h.put("9","2740327403");

            dateNum = new ArrayList();
            data = new ArrayList();
            // 这两个值是用来获取前两期中的数使用的
            int threeIndex = 0;
            int twoIndex = 0;
            LotteryModel lotteryModel = list.get(2);
            String substring = lotteryModel.getLotteryNo().substring(2);
            //  起始位公式为   ((期数-5)%5)  6 11 16 0 = 6    6- x/5
            int va =  ((Integer.parseInt(substring)-5))%5;
            int startIndex = 0;
            if(va == 0){
                startIndex = 1;
            }else{
                startIndex = 6-va;
            }
            startIndex = startIndex+args.getHundredOne(); // 这里计算得是百位 1 2 3 4 5
            if(startIndex==8){
                startIndex = 3;
            }
            if(startIndex==9){
                startIndex = 4;
            }
            for (int i=2;i<list.size();i++){
                threeIndex = i-2;
                twoIndex = i-1;
                LotteryModel lotteryThree = list.get(threeIndex);
                LotteryModel lotteryTwo = list.get(twoIndex);
                LotteryModel lotteryOne = list.get(i);

                //根据当期的彩票结果 求出百十和，十个和，百个和祖成的数组（和10取余） /12345
                String[] threeArray = getSumStringArray(lotteryThree.getLotteryRes().split(","));
                String[] twoArray = getSumStringArray(lotteryTwo.getLotteryRes().split(","));
                String[] oneArray = getSumStringArray(lotteryOne.getLotteryRes().split(","));
                // 通过所传下标获得 0百十和 1十个和 2百个和 获取自组号码中的数据
                String  three = threeArray[buttonIndex];
                String  two = twoArray[buttonIndex];
                String one = oneArray[buttonIndex];

                String threeNum = h.get(three);
                String twoNum = h.get(two);
                String oneNum = h.get(one);
                if(startIndex == 0){
                    startIndex = 5;
                }
                char oneChar = oneNum.charAt(startIndex);
                char twoChar = twoNum.charAt(startIndex+1);
                char threeChar = threeNum.charAt(startIndex+2);
                startIndex--;
                // 拼接计算结果
                String dataStr =oneChar +""+twoChar+threeChar;
                if(args.getTypeFlag() == 1){
                    data.add(oneNum);
                }else{
                    data.add(dataStr);
                }
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryOne.getLotteryDate()+"-"+lotteryOne.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);
                colNum = startIndex;

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        // 将结果返回前端
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);
        plsResult.setColNum(colNum);
        return plsResult;
    }

    /*
     * @Author 李中博
     * @Description 求三位数的 \百十差，\十个差，\百个差祖成的数组（绝对值）
     * @Date 2024/9/19 9:01
     * @Return String[]
     * @param String array
     */
    @Override
    public PLSResult getHundredTenDifferenceRollBack(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        //      RedisUtil.set(CommonConstants.PLS,list,60*60*24);
        List dateNum = null;
        List data = null;
        int  colNum = 0; //列数
        // 为了计算跨度必须提供105期数据
        int buttonIndex = 0;
        switch (args.getOption()){
            case 12:
                buttonIndex = 0;
                break;
            case 13:
                buttonIndex = 1;
                break;
            case 14:
                buttonIndex = 2;
                break;
        }
        if(ObjectUtils.isNotEmpty(list)){
            // 自组号码
            HashMap<String,String> h = new HashMap<>();
            h.put("0","4961549615");
            h.put("1","6072760727");
            h.put("2","1194811948");
            h.put("3","8855488554");
            h.put("4","3216932169");
            h.put("5","9387693876");
            h.put("6","5428054280");
            h.put("7","0509105091");
            h.put("8","7633276332");
            h.put("9","2740327403");

            dateNum = new ArrayList();
            data = new ArrayList();
            // 这两个值是用来获取前两期中的数使用的
            int threeIndex = 0;
            int twoIndex = 0;
            LotteryModel lotteryModel = list.get(2);
            String substring = lotteryModel.getLotteryNo().substring(2);
            //  起始位公式为   ((期数-5)%5)  6 11 16 0 = 6    6- x/5
            int va =  ((Integer.parseInt(substring)-5))%5;
            int startIndex = 0;
            if(va == 0){
                startIndex = 1;
            }else{
                startIndex = 9-(6-va);
            }
            startIndex = startIndex+args.getHundredOne(); // 这里计算得是百位 1 2 3 4 5
            if(startIndex>=10){
                startIndex = (startIndex-9)+4;
            }
            if(startIndex==0){
                startIndex = 5;
            }
            if(startIndex==1){
                startIndex = 6;
            }
            for (int i=2;i<list.size();i++){
                threeIndex = i-2;
                twoIndex = i-1;
                LotteryModel lotteryThree = list.get(threeIndex);
                LotteryModel lotteryTwo = list.get(twoIndex);
                LotteryModel lotteryOne = list.get(i);

                //根据当期的彩票结果 求出百十差，十个差，百个差祖成的数组（绝对值） \12345
                String[] threeArray = getDifferenceStringArray(lotteryThree.getLotteryRes().split(","));
                String[] twoArray = getDifferenceStringArray(lotteryTwo.getLotteryRes().split(","));
                String[] oneArray = getDifferenceStringArray(lotteryOne.getLotteryRes().split(","));
                // 通过所传下标获得 0百十差 1十个差 2百个差 获取自组号码中的数据
                String  three = threeArray[buttonIndex];
                String  two = twoArray[buttonIndex];
                String one = oneArray[buttonIndex];

                String threeNum = h.get(three);
                String twoNum = h.get(two);
                String oneNum = h.get(one);
                if(startIndex == 9){
                    startIndex = 4;
                }
                char oneChar = oneNum.charAt(startIndex);
                char twoChar = twoNum.charAt(startIndex-1);
                char threeChar = threeNum.charAt(startIndex-2);
                startIndex++;
                // 拼接计算结果
                String dataStr =threeChar+""+twoChar+oneChar;
                if(args.getTypeFlag() == 1){
                    data.add(oneNum);
                }else{
                    data.add(dataStr);
                }
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryOne.getLotteryDate()+"-"+lotteryOne.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);
                colNum = startIndex;

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        // 将结果返回前端
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);
        plsResult.setColNum(colNum);
        return plsResult;
    }

    /**
     * 获取\百十和、\十个和、\百个和的数据
     * @return
     */
    @Override
    public PLSResult getHundredTenSumRollBack(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        //      RedisUtil.set(CommonConstants.PLS,list,60*60*24);
        List dateNum = null;
        List data = null;
        int  colNum = 0; //列数
        // 为了计算跨度必须提供105期数据
        int buttonIndex = 0;
        switch (args.getOption()){
            case 20:
                buttonIndex = 0;
                break;
            case 21:
                buttonIndex = 1;
                break;
            case 22:
                buttonIndex = 2;
                break;
        }
        if(ObjectUtils.isNotEmpty(list)){
            // 自组号码
            HashMap<String,String> h = new HashMap<>();
            h.put("0","4961549615");
            h.put("1","6072760727");
            h.put("2","1194811948");
            h.put("3","8855488554");
            h.put("4","3216932169");
            h.put("5","9387693876");
            h.put("6","5428054280");
            h.put("7","0509105091");
            h.put("8","7633276332");
            h.put("9","2740327403");

            dateNum = new ArrayList();
            data = new ArrayList();
            // 这两个值是用来获取前两期中的数使用的
            int threeIndex = 0;
            int twoIndex = 0;
            LotteryModel lotteryModel = list.get(2);
            String substring = lotteryModel.getLotteryNo().substring(2);
            //  起始位公式为   ((期数-5)%5)  6 11 16 0 = 6    6- x/5
            int va =  ((Integer.parseInt(substring)-5))%5;
            int startIndex = 0;
            if(va == 0){
                startIndex = 1;
            }else{
                startIndex = 9-(6-va);
            }
            startIndex = startIndex+args.getHundredOne(); // 这里计算得是百位 1 2 3 4 5
            if(startIndex>=10){
                startIndex = (startIndex-9)+4;
            }
            if(startIndex==0){
                startIndex = 5;
            }
            if(startIndex==1){
                startIndex = 6;
            }
            for (int i=2;i<list.size();i++){
                threeIndex = i-2;
                twoIndex = i-1;
                LotteryModel lotteryThree = list.get(threeIndex);
                LotteryModel lotteryTwo = list.get(twoIndex);
                LotteryModel lotteryOne = list.get(i);

                //根据当期的彩票结果 求出 百十和，十个和，百个和祖成的数组（和10取余）\12345
                String[] threeArray = getSumStringArray(lotteryThree.getLotteryRes().split(","));
                String[] twoArray = getSumStringArray(lotteryTwo.getLotteryRes().split(","));
                String[] oneArray = getSumStringArray(lotteryOne.getLotteryRes().split(","));
                // 通过所传下标获得 0百十和 1十个和 2百个和 获取自组号码中的数据
                String  three = threeArray[buttonIndex];
                String  two = twoArray[buttonIndex];
                String one = oneArray[buttonIndex];

                String threeNum = h.get(three);
                String twoNum = h.get(two);
                String oneNum = h.get(one);
                if(startIndex == 9){
                    startIndex = 4;
                }
                char oneChar = oneNum.charAt(startIndex);
                char twoChar = twoNum.charAt(startIndex-1);
                char threeChar = threeNum.charAt(startIndex-2);
                startIndex++;
                // 拼接计算结果
                String dataStr =threeChar+""+twoChar+oneChar;
                if(args.getTypeFlag() == 1){
                    data.add(oneNum);
                }else{
                    data.add(dataStr);
                }
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryOne.getLotteryDate()+"-"+lotteryOne.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);
                colNum = startIndex;

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        // 将结果返回前端
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);
        plsResult.setColNum(colNum);
        return plsResult;
    }

    /**
     * 获取小中大的数据 /12345
     * @return
     */
    @Override
    public PLSResult getSmallMiddleBig(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        //      RedisUtil.set(CommonConstants.PLS,list,60*60*24);
        List dateNum = null;
        List data = null;
        int  colNum = 0; //列数
        // 为了计算跨度必须提供105期数据
        int buttonIndex = 0;
        switch (args.getOption()){
            case 24:
                buttonIndex = 0;
                break;
            case 25:
                buttonIndex = 1;
                break;
            case 26:
                buttonIndex = 2;
                break;
        }
        if(ObjectUtils.isNotEmpty(list)){
            // 自组号码
            HashMap<String,String> h = new HashMap<>();
            if(buttonIndex==1){
                h.put("0","4961549615");
                h.put("1","6072760727");
                h.put("2","1194811948");
                h.put("3","8855488554");
                h.put("4","3216932169");
                h.put("5","9387693876");
                h.put("6","5428054280");
                h.put("7","0509105091");
                h.put("8","7633276332");
                h.put("9","2740327403");
            }else {
                h.put("0","9961599615");
                h.put("1","6072060720");
                h.put("2","1193711937");
                h.put("3","3254232542");
                h.put("4","5315853158");
                h.put("5","0486404864");
                h.put("6","7527975279");
                h.put("7","2608626086");
                h.put("8","8739187391");
                h.put("9","4840348403");
            }


            dateNum = new ArrayList();
            data = new ArrayList();
            // 这两个值是用来获取前两期中的数使用的
            int threeIndex = 0;
            int twoIndex = 0;
            LotteryModel lotteryModel = list.get(2);
            String substring = lotteryModel.getLotteryNo().substring(2);
            //  起始位公式为   ((期数-5)%5)  6 11 16 0 = 6    6- x/5
            int va =  ((Integer.parseInt(substring)-5))%5;
            int startIndex = 0;
            if(va == 0){
                startIndex = 1;
            }else{
                startIndex = 6-va;
            }
            startIndex = startIndex+args.getHundredOne(); // 这里计算得是百位 1 2 3 4 5
            if(startIndex==8){
                startIndex = 3;
            }
            if(startIndex==9){
                startIndex = 4;
            }
            for (int i=2;i<list.size();i++){
                threeIndex = i-2;
                twoIndex = i-1;
                LotteryModel lotteryThree = list.get(threeIndex);
                LotteryModel lotteryTwo = list.get(twoIndex);
                LotteryModel lotteryOne = list.get(i);

                //根据当期的彩票结果 小中大 /12345
                String[] threeArray = getArrayOrderBy(lotteryThree.getLotteryRes());
                String[] twoArray = getArrayOrderBy(lotteryTwo.getLotteryRes());
                String[] oneArray = getArrayOrderBy(lotteryOne.getLotteryRes());
                // 通过所传下标获得 0小 1中 2大获取自组号码中的数据
                String  three = threeArray[buttonIndex];
                String  two = twoArray[buttonIndex];
                String one = oneArray[buttonIndex];

                String threeNum = h.get(three);
                String twoNum = h.get(two);
                String oneNum = h.get(one);
                if(startIndex == 0){
                    startIndex = 5;
                }
                char oneChar = oneNum.charAt(startIndex);
                char twoChar = twoNum.charAt(startIndex+1);
                char threeChar = threeNum.charAt(startIndex+2);
                startIndex--;
                // 拼接计算结果
                String dataStr =oneChar +""+twoChar+threeChar;
                if(args.getTypeFlag() == 1){
                    data.add(oneNum);
                }else{
                    data.add(dataStr);
                }
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryOne.getLotteryDate()+"-"+lotteryOne.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);
                colNum = startIndex;

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        // 将结果返回前端
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);
        plsResult.setColNum(colNum);
        return plsResult;
    }

    /**
     * 获取/小中差、/中大差、/小大差的数据
     * @return
     */
    @Override
    public PLSResult getSmallMiddleBigDifference(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        //      RedisUtil.set(CommonConstants.PLS,list,60*60*24);
        List dateNum = null;
        List data = null;
        int  colNum = 0; //列数
        // 为了计算跨度必须提供105期数据
        int buttonIndex = 0;
        switch (args.getOption()){
            case 32:
                buttonIndex = 0;
                break;
            case 33:
                buttonIndex = 1;
                break;
            case 34:
                buttonIndex = 2;
                break;
        }
        if(ObjectUtils.isNotEmpty(list)){
            // 自组号码
            HashMap<String,String> h = new HashMap<>();
            h.put("0","4961549615");
            h.put("1","6072760727");
            h.put("2","1194811948");
            h.put("3","8855488554");
            h.put("4","3216932169");
            h.put("5","9387693876");
            h.put("6","5428054280");
            h.put("7","0509105091");
            h.put("8","7633276332");
            h.put("9","2740327403");

            dateNum = new ArrayList();
            data = new ArrayList();
            // 这两个值是用来获取前两期中的数使用的
            int threeIndex = 0;
            int twoIndex = 0;
            LotteryModel lotteryModel = list.get(2);
            String substring = lotteryModel.getLotteryNo().substring(2);
            //  起始位公式为   ((期数-5)%5)  6 11 16 0 = 6    6- x/5
            int va =  ((Integer.parseInt(substring)-5))%5;
            int startIndex = 0;
            if(va == 0){
                startIndex = 1;
            }else{
                startIndex = 6-va;
            }
            startIndex = startIndex+args.getHundredOne(); // 这里计算得是百位 1 2 3 4 5
            if(startIndex==8){
                startIndex = 3;
            }
            if(startIndex==9){
                startIndex = 4;
            }
            for (int i=2;i<list.size();i++){
                threeIndex = i-2;
                twoIndex = i-1;
                LotteryModel lotteryThree = list.get(threeIndex);
                LotteryModel lotteryTwo = list.get(twoIndex);
                LotteryModel lotteryOne = list.get(i);

                //根据当期的彩票结果 进行从小到大排序
                String[] threeArrayOrderBy = getArrayOrderBy(lotteryThree.getLotteryRes());
                String[] twoArrayOrderBy = getArrayOrderBy(lotteryTwo.getLotteryRes());
                String[] oneArrayOrderBy = getArrayOrderBy(lotteryOne.getLotteryRes());
                //求出小中差，中大差，小大差祖成的数组（绝对值） /12345
                String[] threeArray = getDifferenceStringArray(threeArrayOrderBy);
                String[] twoArray = getDifferenceStringArray(twoArrayOrderBy);
                String[] oneArray = getDifferenceStringArray(oneArrayOrderBy);


                // 通过所传下标获得 0百十差 1十个差 2百个差 获取自组号码中的数据
                String  three = threeArray[buttonIndex];
                String  two = twoArray[buttonIndex];
                String one = oneArray[buttonIndex];

                String threeNum = h.get(three);
                String twoNum = h.get(two);
                String oneNum = h.get(one);
                if(startIndex == 0){
                    startIndex = 5;
                }
                char oneChar = oneNum.charAt(startIndex);
                char twoChar = twoNum.charAt(startIndex+1);
                char threeChar = threeNum.charAt(startIndex+2);
                startIndex--;
                // 拼接计算结果
                String dataStr =oneChar +""+twoChar+threeChar;
                if(args.getTypeFlag() == 1){
                    data.add(oneNum);
                }else{
                    data.add(dataStr);
                }
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryOne.getLotteryDate()+"-"+lotteryOne.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);
                colNum = startIndex;

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        // 将结果返回前端
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);
        plsResult.setColNum(colNum);
        return plsResult;
    }

    /**
     * 获取\小中差、\中大差、\小大差的数据
     * @return
     */
    @Override
    public PLSResult getSmallMiddleBigDifferenceRollBack(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        //      RedisUtil.set(CommonConstants.PLS,list,60*60*24);
        List dateNum = null;
        List data = null;
        int  colNum = 0; //列数
        // 为了计算跨度必须提供105期数据
        int buttonIndex = 0;
        switch (args.getOption()){
            case 36:
                buttonIndex = 0;
                break;
            case 37:
                buttonIndex = 1;
                break;
            case 38:
                buttonIndex = 2;
                break;
        }
        if(ObjectUtils.isNotEmpty(list)){
            // 自组号码
            HashMap<String,String> h = new HashMap<>();
            h.put("0","4961549615");
            h.put("1","6072760727");
            h.put("2","1194811948");
            h.put("3","8855488554");
            h.put("4","3216932169");
            h.put("5","9387693876");
            h.put("6","5428054280");
            h.put("7","0509105091");
            h.put("8","7633276332");
            h.put("9","2740327403");

            dateNum = new ArrayList();
            data = new ArrayList();
            // 这两个值是用来获取前两期中的数使用的
            int threeIndex = 0;
            int twoIndex = 0;
            LotteryModel lotteryModel = list.get(2);
            String substring = lotteryModel.getLotteryNo().substring(2);
            //  起始位公式为   ((期数-5)%5)  6 11 16 0 = 6    6- x/5
            int va =  ((Integer.parseInt(substring)-5))%5;
            int startIndex = 0;
            if(va == 0){
                startIndex = 1;
            }else{
                startIndex = 9-(6-va);
            }
            startIndex = startIndex+args.getHundredOne(); // 这里计算得是百位 1 2 3 4 5
            if(startIndex>=10){
                startIndex = (startIndex-9)+4;
            }
            if(startIndex==0){
                startIndex = 5;
            }
            if(startIndex==1){
                startIndex = 6;
            }
            for (int i=2;i<list.size();i++){
                threeIndex = i-2;
                twoIndex = i-1;
                LotteryModel lotteryThree = list.get(threeIndex);
                LotteryModel lotteryTwo = list.get(twoIndex);
                LotteryModel lotteryOne = list.get(i);

                //根据当期的彩票结果 进行从小到大排序
                String[] threeArrayOrderBy = getArrayOrderBy(lotteryThree.getLotteryRes());
                String[] twoArrayOrderBy = getArrayOrderBy(lotteryTwo.getLotteryRes());
                String[] oneArrayOrderBy = getArrayOrderBy(lotteryOne.getLotteryRes());
                //求出小中差，中大差，小大差祖成的数组（绝对值） \12345
                String[] threeArray = getDifferenceStringArray(threeArrayOrderBy);
                String[] twoArray = getDifferenceStringArray(twoArrayOrderBy);
                String[] oneArray = getDifferenceStringArray(oneArrayOrderBy);

                // 通过所传下标获得 0百十差 1十个差 2百个差 获取自组号码中的数据
                String  three = threeArray[buttonIndex];
                String  two = twoArray[buttonIndex];
                String one = oneArray[buttonIndex];

                String threeNum = h.get(three);
                String twoNum = h.get(two);
                String oneNum = h.get(one);
                if(startIndex == 9){
                    startIndex = 4;
                }
                char oneChar = oneNum.charAt(startIndex);
                char twoChar = twoNum.charAt(startIndex-1);
                char threeChar = threeNum.charAt(startIndex-2);
                startIndex++;
                // 拼接计算结果
                String dataStr =threeChar +""+twoChar+oneChar;
                if(args.getTypeFlag() == 1){
                    data.add(oneNum);
                }else{
                    data.add(dataStr);
                }
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryOne.getLotteryDate()+"-"+lotteryOne.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);
                colNum = startIndex;

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        // 将结果返回前端
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);
        plsResult.setColNum(colNum);
        return plsResult;
    }

    /**
     * 获取/小中和、/中大和、/小大和的数据
     * @return
     */
    @Override
    public PLSResult getSmallMiddleBigSum(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        //      RedisUtil.set(CommonConstants.PLS,list,60*60*24);
        List dateNum = null;
        List data = null;
        int  colNum = 0; //列数
        // 为了计算跨度必须提供105期数据
        int buttonIndex = 0;
        switch (args.getOption()){
            case 40:
                buttonIndex = 0;
                break;
            case 41:
                buttonIndex = 1;
                break;
            case 42:
                buttonIndex = 2;
                break;
        }
        if(ObjectUtils.isNotEmpty(list)){
            // 自组号码
            HashMap<String,String> h = new HashMap<>();
            h.put("0","4961549615");
            h.put("1","6072760727");
            h.put("2","1194811948");
            h.put("3","8855488554");
            h.put("4","3216932169");
            h.put("5","9387693876");
            h.put("6","5428054280");
            h.put("7","0509105091");
            h.put("8","7633276332");
            h.put("9","2740327403");

            dateNum = new ArrayList();
            data = new ArrayList();
            // 这两个值是用来获取前两期中的数使用的
            int threeIndex = 0;
            int twoIndex = 0;
            LotteryModel lotteryModel = list.get(2);
            String substring = lotteryModel.getLotteryNo().substring(2);
            //  起始位公式为   ((期数-5)%5)  6 11 16 0 = 6    6- x/5
            int va =  ((Integer.parseInt(substring)-5))%5;
            int startIndex = 0;
            if(va == 0){
                startIndex = 1;
            }else{
                startIndex = 6-va;
            }
            startIndex = startIndex+args.getHundredOne(); // 这里计算得是百位 1 2 3 4 5
            if(startIndex==8){
                startIndex = 3;
            }
            if(startIndex==9){
                startIndex = 4;
            }
            for (int i=2;i<list.size();i++){
                threeIndex = i-2;
                twoIndex = i-1;
                LotteryModel lotteryThree = list.get(threeIndex);
                LotteryModel lotteryTwo = list.get(twoIndex);
                LotteryModel lotteryOne = list.get(i);

                //根据当期的彩票结果 进行从小到大排序
                String[] threeArrayOrderBy = getArrayOrderBy(lotteryThree.getLotteryRes());
                String[] twoArrayOrderBy = getArrayOrderBy(lotteryTwo.getLotteryRes());
                String[] oneArrayOrderBy = getArrayOrderBy(lotteryOne.getLotteryRes());
                //求出小中和，中大和，小大和祖成的数组（绝对值） /12345
                String[] threeArray = getSumStringArray(threeArrayOrderBy);
                String[] twoArray = getSumStringArray(twoArrayOrderBy);
                String[] oneArray = getSumStringArray(oneArrayOrderBy);

                // 通过所传下标获得 0百十差 1十个差 2百个差 获取自组号码中的数据
                String  three = threeArray[buttonIndex];
                String  two = twoArray[buttonIndex];
                String one = oneArray[buttonIndex];

                String threeNum = h.get(three);
                String twoNum = h.get(two);
                String oneNum = h.get(one);
                if(startIndex == 0){
                    startIndex = 5;
                }
                char oneChar = oneNum.charAt(startIndex);
                char twoChar = twoNum.charAt(startIndex+1);
                char threeChar = threeNum.charAt(startIndex+2);
                startIndex--;
                // 拼接计算结果
                String dataStr =oneChar +""+twoChar+threeChar;
                if(args.getTypeFlag() == 1){
                    data.add(oneNum);
                }else{
                    data.add(dataStr);
                }
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryOne.getLotteryDate()+"-"+lotteryOne.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);
                colNum = startIndex;

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        // 将结果返回前端
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);
        plsResult.setColNum(colNum);
        return plsResult;
    }

    /**
     * 获取\小中和、\中大和、\小大和的数据
     * @return
     */
    @Override
    public PLSResult getSmallMiddleBigSumRollBack(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        //      RedisUtil.set(CommonConstants.PLS,list,60*60*24);
        List dateNum = null;
        List data = null;
        int  colNum = 0; //列数
        // 为了计算跨度必须提供105期数据
        int buttonIndex = 0;
        switch (args.getOption()){
            case 44:
                buttonIndex = 0;
                break;
            case 45:
                buttonIndex = 1;
                break;
            case 46:
                buttonIndex = 2;
                break;
        }
        if(ObjectUtils.isNotEmpty(list)){
            // 自组号码
            HashMap<String,String> h = new HashMap<>();
            h.put("0","4961549615");
            h.put("1","6072760727");
            h.put("2","1194811948");
            h.put("3","8855488554");
            h.put("4","3216932169");
            h.put("5","9387693876");
            h.put("6","5428054280");
            h.put("7","0509105091");
            h.put("8","7633276332");
            h.put("9","2740327403");

            dateNum = new ArrayList();
            data = new ArrayList();
            // 这两个值是用来获取前两期中的数使用的
            int threeIndex = 0;
            int twoIndex = 0;
            LotteryModel lotteryModel = list.get(2);
            String substring = lotteryModel.getLotteryNo().substring(2);
            //  起始位公式为   ((期数-5)%5)  6 11 16 0 = 6    6- x/5
            int va =  ((Integer.parseInt(substring)-5))%5;
            int startIndex = 0;
            if(va == 0){
                startIndex = 1;
            }else{
                startIndex = 9-(6-va);
            }
            startIndex = startIndex+args.getHundredOne(); // 这里计算得是百位 1 2 3 4 5
            if(startIndex>=10){
                startIndex = (startIndex-9)+4;
            }
            if(startIndex==0){
                startIndex = 5;
            }
            if(startIndex==1){
                startIndex = 6;
            }
            for (int i=2;i<list.size();i++){
                threeIndex = i-2;
                twoIndex = i-1;
                LotteryModel lotteryThree = list.get(threeIndex);
                LotteryModel lotteryTwo = list.get(twoIndex);
                LotteryModel lotteryOne = list.get(i);

                //根据当期的彩票结果 进行从小到大排序
                String[] threeArrayOrderBy = getArrayOrderBy(lotteryThree.getLotteryRes());
                String[] twoArrayOrderBy = getArrayOrderBy(lotteryTwo.getLotteryRes());
                String[] oneArrayOrderBy = getArrayOrderBy(lotteryOne.getLotteryRes());
                //求出小中和，中大和，小大和祖成的数组（绝对值） \12345
                String[] threeArray = getSumStringArray(threeArrayOrderBy);
                String[] twoArray = getSumStringArray(twoArrayOrderBy);
                String[] oneArray = getSumStringArray(oneArrayOrderBy);


                // 通过所传下标获得 0百十差 1十个差 2百个差 获取自组号码中的数据
                String  three = threeArray[buttonIndex];
                String  two = twoArray[buttonIndex];
                String one = oneArray[buttonIndex];

                String threeNum = h.get(three);
                String twoNum = h.get(two);
                String oneNum = h.get(one);
                if(startIndex == 9){
                    startIndex = 4;
                }
                char oneChar = oneNum.charAt(startIndex);
                char twoChar = twoNum.charAt(startIndex-1);
                char threeChar = threeNum.charAt(startIndex-2);
                startIndex++;
                // 拼接计算结果
                String dataStr =threeChar +""+twoChar+oneChar;
                if(args.getTypeFlag() == 1){
                    data.add(oneNum);
                }else{
                    data.add(dataStr);
                }
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryOne.getLotteryDate()+"-"+lotteryOne.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);
                colNum = startIndex;

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        // 将结果返回前端
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);
        plsResult.setColNum(colNum);
        return plsResult;
    }

    /*
    * @Author 李中博
    * @Description 小中大 \12345
    * @Return com.zhuiyun.project.api.lottery.entity.PLSResult
    * @param args
    */
    @Override
    public PLSResult getSmallMiddleBigRollBack(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        //      RedisUtil.set(CommonConstants.PLS,list,60*60*24);
        List dateNum = null;
        List data = null;
        int  colNum = 0; //列数
        // 为了计算跨度必须提供105期数据
        int buttonIndex = 0;
        switch (args.getOption()){
            case 28:
                buttonIndex = 0;
                break;
            case 29:
                buttonIndex = 1;
                break;
            case 30:
                buttonIndex = 2;
                break;
        }
        if(ObjectUtils.isNotEmpty(list)){
            // 自组号码
            HashMap<String,String> h = new HashMap<>();
            if(buttonIndex==1){
                h.put("0","4961549615");
                h.put("1","6072760727");
                h.put("2","1194811948");
                h.put("3","8855488554");
                h.put("4","3216932169");
                h.put("5","9387693876");
                h.put("6","5428054280");
                h.put("7","0509105091");
                h.put("8","7633276332");
                h.put("9","2740327403");
            }else {
                h.put("0","9961599615");
                h.put("1","6072060720");
                h.put("2","1193711937");
                h.put("3","3254232542");
                h.put("4","5315853158");
                h.put("5","0486404864");
                h.put("6","7527975279");
                h.put("7","2608626086");
                h.put("8","8739187391");
                h.put("9","4840348403");
            }

            dateNum = new ArrayList();
            data = new ArrayList();
            // 这两个值是用来获取前两期中的数使用的
            int threeIndex = 0;
            int twoIndex = 0;
            LotteryModel lotteryModel = list.get(2);
            String substring = lotteryModel.getLotteryNo().substring(2);
            //  起始位公式为   ((期数-5)%5)  6 11 16 0 = 6    6- x/5
            int va =  ((Integer.parseInt(substring)-5))%5;
            int startIndex = 0;
            if(va == 0){
                startIndex = 1;
            }else{
                startIndex = 9-(6-va);
            }
            startIndex = startIndex+args.getHundredOne(); // 这里计算得是百位 1 2 3 4 5
            if(startIndex>=10){
                startIndex = (startIndex-9)+4;
            }
            if(startIndex==0){
                startIndex = 5;
            }
            if(startIndex==1){
                startIndex = 6;
            }
            for (int i=2;i<list.size();i++){
                threeIndex = i-2;
                twoIndex = i-1;
                LotteryModel lotteryThree = list.get(threeIndex);
                LotteryModel lotteryTwo = list.get(twoIndex);
                LotteryModel lotteryOne = list.get(i);

                //根据当期的彩票结果 小中大 \12345
                String[] threeArray = getArrayOrderBy(lotteryThree.getLotteryRes());
                String[] twoArray = getArrayOrderBy(lotteryTwo.getLotteryRes());
                String[] oneArray = getArrayOrderBy(lotteryOne.getLotteryRes());
                // 通过所传下标获得 0小 1中 2大获取自组号码中的数据
                String  three = threeArray[buttonIndex];
                String  two = twoArray[buttonIndex];
                String one = oneArray[buttonIndex];

                String threeNum = h.get(three);
                String twoNum = h.get(two);
                String oneNum = h.get(one);
                if(startIndex == 9){
                    startIndex = 4;
                }
                char oneChar = oneNum.charAt(startIndex);
                char twoChar = twoNum.charAt(startIndex-1);
                char threeChar = threeNum.charAt(startIndex-2);
                startIndex++;
                // 拼接计算结果
                String dataStr =threeChar +""+twoChar+oneChar;
                if(args.getTypeFlag() == 1){
                    data.add(oneNum);
                }else{
                    data.add(dataStr);
                }
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryOne.getLotteryDate()+"-"+lotteryOne.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);
                colNum = startIndex;

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        // 将结果返回前端
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);
        plsResult.setColNum(colNum);
        return plsResult;
    }

    /**
     * 获取1-8胆的数据  /12345
     * @return
     */
    @Override
    public PLSResult getOneAndEight(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        //      RedisUtil.set(CommonConstants.PLS,list,60*60*24);
        List dateNum = null;
        List data = null;
        int  colNum = 0; //列数
        // 为了计算跨度必须提供105期数据

        String butValue=null;
        switch (args.getOption()){
            case 49:
                butValue = "1470369258";
                break;
            case 64:
                butValue = "8529630741";
                break;
        }
        if(ObjectUtils.isNotEmpty(list)){
            // 自组号码
            HashMap<String,String> h = new HashMap<>();
            h.put("0","7763877638");
            h.put("1","2874428744");
            h.put("2","8995989959");
            h.put("3","4056640566");
            h.put("4","9117191171");
            h.put("5","6288362883");
            h.put("6","1329513295");
            h.put("7","3400034000");
            h.put("8","5531755317");
            h.put("9","0642206422");

            dateNum = new ArrayList();
            data = new ArrayList();
            // 这两个值是用来获取前两期中的数使用的
            int threeIndex = 0;
            int twoIndex = 0;
            LotteryModel lotteryModel = list.get(2);
            String substring = lotteryModel.getLotteryNo().substring(2);
            //  起始位公式为   ((期数-5)%5)  6 11 16 0 = 6    6- x/5
            int va =  ((Integer.parseInt(substring)-5))%5;
            int startIndex = 0;
            if(va == 0){
                startIndex = 1;
            }else{
                startIndex = 6-va;
            }
            startIndex = startIndex+args.getHundredOne(); // 这里计算得是百位 1 2 3 4 5
            if(startIndex==8){
                startIndex = 3;
            }
            if(startIndex==9){
                startIndex = 4;
            }
            for (int i=2;i<list.size();i++){
                threeIndex = i-2;
                twoIndex = i-1;
                LotteryModel lotteryThree = list.get(threeIndex);
                LotteryModel lotteryTwo = list.get(twoIndex);
                LotteryModel lotteryOne = list.get(i);

                //根据当期的彩票结果 根据数组每个数所在 butValue所出现的先后顺序排序
                String[] threeArray = getSort(lotteryThree.getLotteryRes().split(","), butValue);
                String[] twoArray = getSort(lotteryTwo.getLotteryRes().split(","),butValue);
                String[] oneArray = getSort(lotteryOne.getLotteryRes().split(","),butValue);


                String  three = threeArray[0];
                String  two = twoArray[0];
                String one = oneArray[0];

                String threeNum = h.get(three);
                String twoNum = h.get(two);
                String oneNum = h.get(one);
                if(startIndex == 0){
                    startIndex = 5;
                }
                char oneChar = oneNum.charAt(startIndex);
                char twoChar = twoNum.charAt(startIndex+1);
                char threeChar = threeNum.charAt(startIndex+2);
                startIndex--;
                // 拼接计算结果
                String dataStr =oneChar +""+twoChar+threeChar;
                if(args.getTypeFlag() == 1){
                    data.add(oneNum);
                }else{
                    data.add(dataStr);
                }
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryOne.getLotteryDate()+"-"+lotteryOne.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);
                colNum = startIndex;

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        // 将结果返回前端
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);
        plsResult.setColNum(colNum);
        return plsResult;
    }

    /**
     * 获取1-8胆的数据  \12345
     * @return
     */
    @Override
    public PLSResult getOneAndEightRollBack(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        //      RedisUtil.set(CommonConstants.PLS,list,60*60*24);
        List dateNum = null;
        List data = null;
        int  colNum = 0; //列数
        // 为了计算跨度必须提供105期数据

        String butValue=null;
        switch (args.getOption()){
            case 53:
                butValue = "1470369258";
                break;
            case 68:
                butValue = "8529630741";
                break;
        }
        if(ObjectUtils.isNotEmpty(list)){
            // 自组号码
            HashMap<String,String> h = new HashMap<>();
            h.put("0","7763877638");
            h.put("1","2874428744");
            h.put("2","8995989959");
            h.put("3","4056640566");
            h.put("4","9117191171");
            h.put("5","6288362883");
            h.put("6","1329513295");
            h.put("7","3400034000");
            h.put("8","5531755317");
            h.put("9","0642206422");

            dateNum = new ArrayList();
            data = new ArrayList();
            // 这两个值是用来获取前两期中的数使用的
            int threeIndex = 0;
            int twoIndex = 0;
            LotteryModel lotteryModel = list.get(2);
            String substring = lotteryModel.getLotteryNo().substring(2);
            //  起始位公式为   ((期数-5)%5)  6 11 16 0 = 6    6- x/5
            int va =  ((Integer.parseInt(substring)-5))%5;
            int startIndex = 0;
            if(va == 0){
                startIndex = 1;
            }else{
                startIndex = 9-(6-va);
            }
            startIndex = startIndex+args.getHundredOne(); // 这里计算得是百位 1 2 3 4 5
            if(startIndex>=10){
                startIndex = (startIndex-9)+4;
            }
            if(startIndex==0){
                startIndex = 5;
            }
            if(startIndex==1){
                startIndex = 6;
            }
            for (int i=2;i<list.size();i++){
                threeIndex = i-2;
                twoIndex = i-1;
                LotteryModel lotteryThree = list.get(threeIndex);
                LotteryModel lotteryTwo = list.get(twoIndex);
                LotteryModel lotteryOne = list.get(i);

                //根据当期的彩票结果 根据数组每个数所在 butValue所出现的先后顺序排序
                String[] threeArray = getSort(lotteryThree.getLotteryRes().split(","), butValue);
                String[] twoArray = getSort(lotteryTwo.getLotteryRes().split(","),butValue);
                String[] oneArray = getSort(lotteryOne.getLotteryRes().split(","),butValue);


                String  three = threeArray[0];
                String  two = twoArray[0];
                String one = oneArray[0];

                String threeNum = h.get(three);
                String twoNum = h.get(two);
                String oneNum = h.get(one);
                if(startIndex == 9){
                    startIndex = 4;
                }
                char oneChar = oneNum.charAt(startIndex);
                char twoChar = twoNum.charAt(startIndex-1);
                char threeChar = threeNum.charAt(startIndex-2);
                startIndex++;
                // 拼接计算结果
                String dataStr =threeChar +""+twoChar+oneChar;
                if(args.getTypeFlag() == 1){
                    data.add(oneNum);
                }else{
                    data.add(dataStr);
                }
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryOne.getLotteryDate()+"-"+lotteryOne.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);
                colNum = startIndex;

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        // 将结果返回前端
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);
        plsResult.setColNum(colNum);
        return plsResult;
    }

    /**
     * 获取3-7胆的数据  /12345
     * @return
     */
    @Override
    public PLSResult getThreeAndSeven(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        //      RedisUtil.set(CommonConstants.PLS,list,60*60*24);
        List dateNum = null;
        List data = null;
        int  colNum = 0; //列数
        // 为了计算跨度必须提供105期数据

        String butValue=null;
        switch (args.getOption()){
            case 51:
                butValue = "3480159267";
                break;
            case 59:
                butValue = "7629510843";
                break;
        }
        if(ObjectUtils.isNotEmpty(list)){
            // 自组号码
            HashMap<String,String> h = new HashMap<>();
            h.put("0","7861278612");
            h.put("1","9075690756");
            h.put("2","2996429964");
            h.put("3","8754987549");
            h.put("4","4318143181");
            h.put("5","1189511895");
            h.put("6","6227062270");
            h.put("7","5603756037");
            h.put("8","0430304303");
            h.put("9","3542835428");

            dateNum = new ArrayList();
            data = new ArrayList();
            // 这两个值是用来获取前两期中的数使用的
            int threeIndex = 0;
            int twoIndex = 0;
            LotteryModel lotteryModel = list.get(2);
            String substring = lotteryModel.getLotteryNo().substring(2);
            //  起始位公式为   ((期数-5)%5)  6 11 16 0 = 6    6- x/5
            int va =  ((Integer.parseInt(substring)-5))%5;
            int startIndex = 0;
            if(va == 0){
                startIndex = 1;
            }else{
                startIndex = 6-va;
            }
            startIndex = startIndex+args.getHundredOne(); // 这里计算得是百位 1 2 3 4 5
            if(startIndex==8){
                startIndex = 3;
            }
            if(startIndex==9){
                startIndex = 4;
            }
            for (int i=2;i<list.size();i++){
                threeIndex = i-2;
                twoIndex = i-1;
                LotteryModel lotteryThree = list.get(threeIndex);
                LotteryModel lotteryTwo = list.get(twoIndex);
                LotteryModel lotteryOne = list.get(i);

                //根据当期的彩票结果 根据数组每个数所在 butValue所出现的先后顺序排序
                String[] threeArray = getSort(lotteryThree.getLotteryRes().split(","), butValue);
                String[] twoArray = getSort(lotteryTwo.getLotteryRes().split(","),butValue);
                String[] oneArray = getSort(lotteryOne.getLotteryRes().split(","),butValue);


                String  three = threeArray[0];
                String  two = twoArray[0];
                String one = oneArray[0];

                String threeNum = h.get(three);
                String twoNum = h.get(two);
                String oneNum = h.get(one);
                if(startIndex == 0){
                    startIndex = 5;
                }
                char oneChar = oneNum.charAt(startIndex);
                char twoChar = twoNum.charAt(startIndex+1);
                char threeChar = threeNum.charAt(startIndex+2);
                startIndex--;
                // 拼接计算结果
                String dataStr =oneChar +""+twoChar+threeChar;
                if(args.getTypeFlag() == 1){
                    data.add(oneNum);
                }else{
                    data.add(dataStr);
                }
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryOne.getLotteryDate()+"-"+lotteryOne.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);
                colNum = startIndex;

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        // 将结果返回前端
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);
        plsResult.setColNum(colNum);
        return plsResult;
    }

    /**
     * 获取3-7胆的数据  \12345
     * @return
     */
    @Override
    public PLSResult getThreeAndSevenRollBack(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        //      RedisUtil.set(CommonConstants.PLS,list,60*60*24);
        List dateNum = null;
        List data = null;
        int  colNum = 0; //列数
        // 为了计算跨度必须提供105期数据

        String butValue=null;
        switch (args.getOption()){
            case 55:
                butValue = "3480159267";
                break;
            case 63:
                butValue = "7629510843";
                break;
        }
        if(ObjectUtils.isNotEmpty(list)){
            // 自组号码
            HashMap<String,String> h = new HashMap<>();
            h.put("0","7861278612");
            h.put("1","9075690756");
            h.put("2","2996429964");
            h.put("3","8754987549");
            h.put("4","4318143181");
            h.put("5","1189511895");
            h.put("6","6227062270");
            h.put("7","5603756037");
            h.put("8","0430304303");
            h.put("9","3542835428");

            dateNum = new ArrayList();
            data = new ArrayList();
            // 这两个值是用来获取前两期中的数使用的
            int threeIndex = 0;
            int twoIndex = 0;
            LotteryModel lotteryModel = list.get(2);
            String substring = lotteryModel.getLotteryNo().substring(2);
            //  起始位公式为   ((期数-5)%5)  6 11 16 0 = 6    6- x/5
            int va =  ((Integer.parseInt(substring)-5))%5;
            int startIndex = 0;
            if(va == 0){
                startIndex = 1;
            }else{
                startIndex = 9-(6-va);
            }
            startIndex = startIndex+args.getHundredOne(); // 这里计算得是百位 1 2 3 4 5
            if(startIndex>=10){
                startIndex = (startIndex-9)+4;
            }
            if(startIndex==0){
                startIndex = 5;
            }
            if(startIndex==1){
                startIndex = 6;
            }
            for (int i=2;i<list.size();i++){
                threeIndex = i-2;
                twoIndex = i-1;
                LotteryModel lotteryThree = list.get(threeIndex);
                LotteryModel lotteryTwo = list.get(twoIndex);
                LotteryModel lotteryOne = list.get(i);

                //根据当期的彩票结果 根据数组每个数所在 butValue所出现的先后顺序排序
                String[] threeArray = getSort(lotteryThree.getLotteryRes().split(","), butValue);
                String[] twoArray = getSort(lotteryTwo.getLotteryRes().split(","),butValue);
                String[] oneArray = getSort(lotteryOne.getLotteryRes().split(","),butValue);


                String  three = threeArray[0];
                String  two = twoArray[0];
                String one = oneArray[0];

                String threeNum = h.get(three);
                String twoNum = h.get(two);
                String oneNum = h.get(one);
                if(startIndex == 9){
                    startIndex = 4;
                }
                char oneChar = oneNum.charAt(startIndex);
                char twoChar = twoNum.charAt(startIndex-1);
                char threeChar = threeNum.charAt(startIndex-2);
                startIndex++;
                // 拼接计算结果
                String dataStr =threeChar +""+twoChar+oneChar;
                if(args.getTypeFlag() == 1){
                    data.add(oneNum);
                }else{
                    data.add(dataStr);
                }
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryOne.getLotteryDate()+"-"+lotteryOne.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);
                colNum = startIndex;

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        // 将结果返回前端
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);
        plsResult.setColNum(colNum);
        return plsResult;
    }

    /**
     * 获取5-6胆的数据  /12345
     * @return
     */
    @Override
    public PLSResult getFiveAndSix(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        //      RedisUtil.set(CommonConstants.PLS,list,60*60*24);
        List dateNum = null;
        List data = null;
        int  colNum = 0; //列数
        // 为了计算跨度必须提供105期数据

        String butValue=null;
        switch (args.getOption()){
            case 57:
                butValue = "5049382716";
                break;
            case 58:
                butValue = "6172839405";
                break;
        }
        if(ObjectUtils.isNotEmpty(list)){
            // 自组号码
            HashMap<String,String> h = new HashMap<>();
            h.put("0","6465864658");
            h.put("1","2677526775");
            h.put("2","3798037980");
            h.put("3","5859758597");
            h.put("4","0910209102");
            h.put("5","7086370863");
            h.put("6","1521415214");
            h.put("7","8102981029");
            h.put("8","4233642336");
            h.put("9","9344193441");

            dateNum = new ArrayList();
            data = new ArrayList();
            // 这两个值是用来获取前两期中的数使用的
            int threeIndex = 0;
            int twoIndex = 0;
            LotteryModel lotteryModel = list.get(2);
            String substring = lotteryModel.getLotteryNo().substring(2);
            //  起始位公式为   ((期数-5)%5)  6 11 16 0 = 6    6- x/5
            int va =  ((Integer.parseInt(substring)-5))%5;
            int startIndex = 0;
            if(va == 0){
                startIndex = 1;
            }else{
                startIndex = 6-va;
            }
            startIndex = startIndex+args.getHundredOne(); // 这里计算得是百位 1 2 3 4 5
            if(startIndex==8){
                startIndex = 3;
            }
            if(startIndex==9){
                startIndex = 4;
            }
            for (int i=2;i<list.size();i++){
                threeIndex = i-2;
                twoIndex = i-1;
                LotteryModel lotteryThree = list.get(threeIndex);
                LotteryModel lotteryTwo = list.get(twoIndex);
                LotteryModel lotteryOne = list.get(i);

                //根据当期的彩票结果 根据数组每个数所在 butValue所出现的先后顺序排序
                String[] threeArray = getSort(lotteryThree.getLotteryRes().split(","), butValue);
                String[] twoArray = getSort(lotteryTwo.getLotteryRes().split(","),butValue);
                String[] oneArray = getSort(lotteryOne.getLotteryRes().split(","),butValue);


                String  three = threeArray[0];
                String  two = twoArray[0];
                String one = oneArray[0];

                String threeNum = h.get(three);
                String twoNum = h.get(two);
                String oneNum = h.get(one);
                if(startIndex == 0){
                    startIndex = 5;
                }
                char oneChar = oneNum.charAt(startIndex);
                char twoChar = twoNum.charAt(startIndex+1);
                char threeChar = threeNum.charAt(startIndex+2);
                startIndex--;
                // 拼接计算结果
                String dataStr =oneChar +""+twoChar+threeChar;
                if(args.getTypeFlag() == 1){
                    data.add(oneNum);
                }else{
                    data.add(dataStr);
                }
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryOne.getLotteryDate()+"-"+lotteryOne.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);
                colNum = startIndex;

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        // 将结果返回前端
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);
        plsResult.setColNum(colNum);
        return plsResult;
    }

    /**
     * 获取5-6胆的数据  \12345
     * @return
     */
    @Override
    public PLSResult getFiveAndSixRollBack(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        //      RedisUtil.set(CommonConstants.PLS,list,60*60*24);
        List dateNum = null;
        List data = null;
        int  colNum = 0; //列数
        // 为了计算跨度必须提供105期数据

        String butValue=null;
        switch (args.getOption()){
            case 61:
                butValue = "5049382716";
                break;
            case 62:
                butValue = "6172839405";
                break;
        }
        if(ObjectUtils.isNotEmpty(list)){
            // 自组号码
            HashMap<String,String> h = new HashMap<>();
            h.put("0","6465864658");
            h.put("1","2677526775");
            h.put("2","3798037980");
            h.put("3","5859758597");
            h.put("4","0910209102");
            h.put("5","7086370863");
            h.put("6","1521415214");
            h.put("7","8102981029");
            h.put("8","4233642336");
            h.put("9","9344193441");

            dateNum = new ArrayList();
            data = new ArrayList();
            // 这两个值是用来获取前两期中的数使用的
            int threeIndex = 0;
            int twoIndex = 0;
            LotteryModel lotteryModel = list.get(2);
            String substring = lotteryModel.getLotteryNo().substring(2);
            //  起始位公式为   ((期数-5)%5)  6 11 16 0 = 6    6- x/5
            int va =  ((Integer.parseInt(substring)-5))%5;
            int startIndex = 0;
            if(va == 0){
                startIndex = 1;
            }else{
                startIndex = 9-(6-va);
            }
            startIndex = startIndex+args.getHundredOne(); // 这里计算得是百位 1 2 3 4 5
            if(startIndex>=10){
                startIndex = (startIndex-9)+4;
            }
            if(startIndex==0){
                startIndex = 5;
            }
            if(startIndex==1){
                startIndex = 6;
            }
            for (int i=2;i<list.size();i++){
                threeIndex = i-2;
                twoIndex = i-1;
                LotteryModel lotteryThree = list.get(threeIndex);
                LotteryModel lotteryTwo = list.get(twoIndex);
                LotteryModel lotteryOne = list.get(i);

                //根据当期的彩票结果 根据数组每个数所在 butValue所出现的先后顺序排序
                String[] threeArray = getSort(lotteryThree.getLotteryRes().split(","), butValue);
                String[] twoArray = getSort(lotteryTwo.getLotteryRes().split(","),butValue);
                String[] oneArray = getSort(lotteryOne.getLotteryRes().split(","),butValue);


                String  three = threeArray[0];
                String  two = twoArray[0];
                String one = oneArray[0];

                String threeNum = h.get(three);
                String twoNum = h.get(two);
                String oneNum = h.get(one);
                if(startIndex == 9){
                    startIndex = 4;
                }
                char oneChar = oneNum.charAt(startIndex);
                char twoChar = twoNum.charAt(startIndex-1);
                char threeChar = threeNum.charAt(startIndex-2);
                startIndex++;
                // 拼接计算结果
                String dataStr =threeChar +""+twoChar+oneChar;
                if(args.getTypeFlag() == 1){
                    data.add(oneNum);
                }else{
                    data.add(dataStr);
                }
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryOne.getLotteryDate()+"-"+lotteryOne.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);
                colNum = startIndex;

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        // 将结果返回前端
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);
        plsResult.setColNum(colNum);
        return plsResult;
    }

    /**
     * 获取4-2胆的数据  /12345
     * @return
     */
    @Override
    public PLSResult getFourAndTwo(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        //      RedisUtil.set(CommonConstants.PLS,list,60*60*24);
        List dateNum = null;
        List data = null;
        int  colNum = 0; //列数
        // 为了计算跨度必须提供105期数据

        String butValue=null;
        switch (args.getOption()){
            case 56:
                butValue = "4683579012";
                break;
            case 50:
                butValue = "2109753864";
                break;
        }
        if(ObjectUtils.isNotEmpty(list)){
            // 自组号码
            HashMap<String,String> h = new HashMap<>();
            h.put("0","4961549615");
            h.put("1","6072760727");
            h.put("2","1194811948");
            h.put("3","8855488554");
            h.put("4","3216932169");
            h.put("5","9387693876");
            h.put("6","5428054280");
            h.put("7","0509105091");
            h.put("8","7633276332");
            h.put("9","2740327403");

            dateNum = new ArrayList();
            data = new ArrayList();
            // 这两个值是用来获取前两期中的数使用的
            int threeIndex = 0;
            int twoIndex = 0;
            LotteryModel lotteryModel = list.get(2);
            String substring = lotteryModel.getLotteryNo().substring(2);
            //  起始位公式为   ((期数-5)%5)  6 11 16 0 = 6    6- x/5
            int va =  ((Integer.parseInt(substring)-5))%5;
            int startIndex = 0;
            if(va == 0){
                startIndex = 1;
            }else{
                startIndex = 6-va;
            }
            startIndex = startIndex+args.getHundredOne(); // 这里计算得是百位 1 2 3 4 5
            if(startIndex==8){
                startIndex = 3;
            }
            if(startIndex==9){
                startIndex = 4;
            }
            for (int i=2;i<list.size();i++){
                threeIndex = i-2;
                twoIndex = i-1;
                LotteryModel lotteryThree = list.get(threeIndex);
                LotteryModel lotteryTwo = list.get(twoIndex);
                LotteryModel lotteryOne = list.get(i);

                //根据当期的彩票结果 根据数组每个数所在 butValue所出现的先后顺序排序
                String[] threeArray = getSort(lotteryThree.getLotteryRes().split(","), butValue);
                String[] twoArray = getSort(lotteryTwo.getLotteryRes().split(","),butValue);
                String[] oneArray = getSort(lotteryOne.getLotteryRes().split(","),butValue);


                String  three = threeArray[0];
                String  two = twoArray[0];
                String one = oneArray[0];

                String threeNum = h.get(three);
                String twoNum = h.get(two);
                String oneNum = h.get(one);
                if(startIndex == 0){
                    startIndex = 5;
                }
                char oneChar = oneNum.charAt(startIndex);
                char twoChar = twoNum.charAt(startIndex+1);
                char threeChar = threeNum.charAt(startIndex+2);
                startIndex--;
                // 拼接计算结果
                String dataStr =oneChar +""+twoChar+threeChar;
                if(args.getTypeFlag() == 1){
                    data.add(oneNum);
                }else{
                    data.add(dataStr);
                }
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryOne.getLotteryDate()+"-"+lotteryOne.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);
                colNum = startIndex;

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        // 将结果返回前端
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);
        plsResult.setColNum(colNum);
        return plsResult;
    }

    /**
     * 获取4-2胆的数据  \12345
     * @return
     */
    @Override
    public PLSResult getFourAndTwoRollBack(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        //      RedisUtil.set(CommonConstants.PLS,list,60*60*24);
        List dateNum = null;
        List data = null;
        int  colNum = 0; //列数
        // 为了计算跨度必须提供105期数据

        String butValue=null;
        switch (args.getOption()){
            case 60:
                butValue = "4683579012";
                break;
            case 54:
                butValue = "2109753864";
                break;
        }
        if(ObjectUtils.isNotEmpty(list)){
            // 自组号码
            HashMap<String,String> h = new HashMap<>();
            h.put("0","4961549615");
            h.put("1","6072760727");
            h.put("2","1194811948");
            h.put("3","8855488554");
            h.put("4","3216932169");
            h.put("5","9387693876");
            h.put("6","5428054280");
            h.put("7","0509105091");
            h.put("8","7633276332");
            h.put("9","2740327403");

            dateNum = new ArrayList();
            data = new ArrayList();
            // 这两个值是用来获取前两期中的数使用的
            int threeIndex = 0;
            int twoIndex = 0;
            LotteryModel lotteryModel = list.get(2);
            String substring = lotteryModel.getLotteryNo().substring(2);
            //  起始位公式为   ((期数-5)%5)  6 11 16 0 = 6    6- x/5
            int va =  ((Integer.parseInt(substring)-5))%5;
            int startIndex = 0;
            if(va == 0){
                startIndex = 1;
            }else{
                startIndex = 9-(6-va);
            }
            startIndex = startIndex+args.getHundredOne(); // 这里计算得是百位 1 2 3 4 5
            if(startIndex>=10){
                startIndex = (startIndex-9)+4;
            }
            if(startIndex==0){
                startIndex = 5;
            }
            if(startIndex==1){
                startIndex = 6;
            }
            for (int i=2;i<list.size();i++){
                threeIndex = i-2;
                twoIndex = i-1;
                LotteryModel lotteryThree = list.get(threeIndex);
                LotteryModel lotteryTwo = list.get(twoIndex);
                LotteryModel lotteryOne = list.get(i);

                //根据当期的彩票结果 根据数组每个数所在 butValue所出现的先后顺序排序
                String[] threeArray = getSort(lotteryThree.getLotteryRes().split(","), butValue);
                String[] twoArray = getSort(lotteryTwo.getLotteryRes().split(","),butValue);
                String[] oneArray = getSort(lotteryOne.getLotteryRes().split(","),butValue);


                String  three = threeArray[0];
                String  two = twoArray[0];
                String one = oneArray[0];

                String threeNum = h.get(three);
                String twoNum = h.get(two);
                String oneNum = h.get(one);
                if(startIndex == 9){
                    startIndex = 4;
                }
                char oneChar = oneNum.charAt(startIndex);
                char twoChar = twoNum.charAt(startIndex-1);
                char threeChar = threeNum.charAt(startIndex-2);
                startIndex++;
                // 拼接计算结果
                String dataStr =threeChar +""+twoChar+oneChar;
                if(args.getTypeFlag() == 1){
                    data.add(oneNum);
                }else{
                    data.add(dataStr);
                }
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryOne.getLotteryDate()+"-"+lotteryOne.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);
                colNum = startIndex;

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        // 将结果返回前端
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);
        plsResult.setColNum(colNum);
        return plsResult;
    }

    /**
     * 获取0-9胆的数据  /12345
     * @return
     */
    @Override
    public PLSResult getZeroAndNine(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        //      RedisUtil.set(CommonConstants.PLS,list,60*60*24);
        List dateNum = null;
        List data = null;
        int  colNum = 0; //列数
        // 为了计算跨度必须提供105期数据

        String butValue=null;
        switch (args.getOption()){
            case 48:
                butValue = "0123456789";
                break;
            case 65:
                butValue = "9876543210";
                break;
        }
        if(ObjectUtils.isNotEmpty(list)){
            // 自组号码
            HashMap<String,String> h = new HashMap<>();
            h.put("0","9961599615");
            h.put("1","6072060720");
            h.put("2","1193711937");
            h.put("3","3254232542");
            h.put("4","5315853158");
            h.put("5","0486404864");
            h.put("6","7527975279");
            h.put("7","2608626086");
            h.put("8","8739187391");
            h.put("9","4840348403");

            dateNum = new ArrayList();
            data = new ArrayList();
            // 这两个值是用来获取前两期中的数使用的
            int threeIndex = 0;
            int twoIndex = 0;
            LotteryModel lotteryModel = list.get(2);
            String substring = lotteryModel.getLotteryNo().substring(2);
            //  起始位公式为   ((期数-5)%5)  6 11 16 0 = 6    6- x/5
            int va =  ((Integer.parseInt(substring)-5))%5;
            int startIndex = 0;
            if(va == 0){
                startIndex = 1;
            }else{
                startIndex = 6-va;
            }
            startIndex = startIndex+args.getHundredOne(); // 这里计算得是百位 1 2 3 4 5
            if(startIndex==8){
                startIndex = 3;
            }
            if(startIndex==9){
                startIndex = 4;
            }
            for (int i=2;i<list.size();i++){
                threeIndex = i-2;
                twoIndex = i-1;
                LotteryModel lotteryThree = list.get(threeIndex);
                LotteryModel lotteryTwo = list.get(twoIndex);
                LotteryModel lotteryOne = list.get(i);

                //根据当期的彩票结果 根据数组每个数所在 butValue所出现的先后顺序排序
                String[] threeArray = getSort(lotteryThree.getLotteryRes().split(","), butValue);
                String[] twoArray = getSort(lotteryTwo.getLotteryRes().split(","),butValue);
                String[] oneArray = getSort(lotteryOne.getLotteryRes().split(","),butValue);


                String  three = threeArray[0];
                String  two = twoArray[0];
                String one = oneArray[0];

                String threeNum = h.get(three);
                String twoNum = h.get(two);
                String oneNum = h.get(one);
                if(startIndex == 0){
                    startIndex = 5;
                }
                char oneChar = oneNum.charAt(startIndex);
                char twoChar = twoNum.charAt(startIndex+1);
                char threeChar = threeNum.charAt(startIndex+2);
                startIndex--;
                // 拼接计算结果
                String dataStr =oneChar +""+twoChar+threeChar;
                if(args.getTypeFlag() == 1){
                    data.add(oneNum);
                }else{
                    data.add(dataStr);
                }
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryOne.getLotteryDate()+"-"+lotteryOne.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);
                colNum = startIndex;

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        // 将结果返回前端
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);
        plsResult.setColNum(colNum);
        return plsResult;
    }

    /**
     * 获取0-9胆的数据  \12345
     * @return
     */
    @Override
    public PLSResult getZeroAndNineRollBack(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        //      RedisUtil.set(CommonConstants.PLS,list,60*60*24);
        List dateNum = null;
        List data = null;
        int  colNum = 0; //列数
        // 为了计算跨度必须提供105期数据

        String butValue=null;
        switch (args.getOption()){
            case 52:
                butValue = "0123456789";
                break;
            case 69:
                butValue = "9876543210";
                break;
        }
        if(ObjectUtils.isNotEmpty(list)){
            // 自组号码
            HashMap<String,String> h = new HashMap<>();
            h.put("0","9961599615");
            h.put("1","6072060720");
            h.put("2","1193711937");
            h.put("3","3254232542");
            h.put("4","5315853158");
            h.put("5","0486404864");
            h.put("6","7527975279");
            h.put("7","2608626086");
            h.put("8","8739187391");
            h.put("9","4840348403");

            dateNum = new ArrayList();
            data = new ArrayList();
            // 这两个值是用来获取前两期中的数使用的
            int threeIndex = 0;
            int twoIndex = 0;
            LotteryModel lotteryModel = list.get(2);
            String substring = lotteryModel.getLotteryNo().substring(2);
            //  起始位公式为   ((期数-5)%5)  6 11 16 0 = 6    6- x/5
            int va =  ((Integer.parseInt(substring)-5))%5;
            int startIndex = 0;
            if(va == 0){
                startIndex = 1;
            }else{
                startIndex = 9-(6-va);
            }
            startIndex = startIndex+args.getHundredOne(); // 这里计算得是百位 1 2 3 4 5
            if(startIndex>=10){
                startIndex = (startIndex-9)+4;
            }
            if(startIndex==0){
                startIndex = 5;
            }
            if(startIndex==1){
                startIndex = 6;
            }
            for (int i=2;i<list.size();i++){
                threeIndex = i-2;
                twoIndex = i-1;
                LotteryModel lotteryThree = list.get(threeIndex);
                LotteryModel lotteryTwo = list.get(twoIndex);
                LotteryModel lotteryOne = list.get(i);

                //根据当期的彩票结果 根据数组每个数所在 butValue所出现的先后顺序排序
                String[] threeArray = getSort(lotteryThree.getLotteryRes().split(","), butValue);
                String[] twoArray = getSort(lotteryTwo.getLotteryRes().split(","),butValue);
                String[] oneArray = getSort(lotteryOne.getLotteryRes().split(","),butValue);


                String  three = threeArray[0];
                String  two = twoArray[0];
                String one = oneArray[0];

                String threeNum = h.get(three);
                String twoNum = h.get(two);
                String oneNum = h.get(one);
                if(startIndex == 9){
                    startIndex = 4;
                }
                char oneChar = oneNum.charAt(startIndex);
                char twoChar = twoNum.charAt(startIndex-1);
                char threeChar = threeNum.charAt(startIndex-2);
                startIndex++;
                // 拼接计算结果
                String dataStr =threeChar +""+twoChar+oneChar;
                if(args.getTypeFlag() == 1){
                    data.add(oneNum);
                }else{
                    data.add(dataStr);
                }
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryOne.getLotteryDate()+"-"+lotteryOne.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);
                colNum = startIndex;

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        // 将结果返回前端
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);
        plsResult.setColNum(colNum);
        return plsResult;
    }

    /**
     * 获取1-8差胆的数据  /12345
     * @return
     */
    @Override
    public PLSResult getOneAndEightDifference(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        //      RedisUtil.set(CommonConstants.PLS,list,60*60*24);
        List dateNum = null;
        List data = null;
        int  colNum = 0; //列数
        // 为了计算跨度必须提供105期数据

        String butValue=null;
        switch (args.getOption()){
            case 73:
                butValue = "1470369258";
                break;
            case 88:
                butValue = "8529630741";
                break;
        }
        if(ObjectUtils.isNotEmpty(list)){
            // 自组号码
            HashMap<String,String> h = new HashMap<>();
            h.put("0","7763877638");
            h.put("1","2874428744");
            h.put("2","8995989959");
            h.put("3","4056640566");
            h.put("4","9117191171");
            h.put("5","6288362883");
            h.put("6","1329513295");
            h.put("7","3400034000");
            h.put("8","5531755317");
            h.put("9","0642206422");

            dateNum = new ArrayList();
            data = new ArrayList();
            // 这两个值是用来获取前两期中的数使用的
            int threeIndex = 0;
            int twoIndex = 0;
            LotteryModel lotteryModel = list.get(2);
            String substring = lotteryModel.getLotteryNo().substring(2);
            //  起始位公式为   ((期数-5)%5)  6 11 16 0 = 6    6- x/5
            int va =  ((Integer.parseInt(substring)-5))%5;
            int startIndex = 0;
            if(va == 0){
                startIndex = 1;
            }else{
                startIndex = 6-va;
            }
            startIndex = startIndex+args.getHundredOne(); // 这里计算得是百位 1 2 3 4 5
            if(startIndex==8){
                startIndex = 3;
            }
            if(startIndex==9){
                startIndex = 4;
            }
            for (int i=2;i<list.size();i++){
                threeIndex = i-2;
                twoIndex = i-1;
                LotteryModel lotteryThree = list.get(threeIndex);
                LotteryModel lotteryTwo = list.get(twoIndex);
                LotteryModel lotteryOne = list.get(i);

                String[] threeArrayDifference = getDifferenceStringArray(lotteryThree.getLotteryRes().split(","));
                String[] twoArrayDifference = getDifferenceStringArray(lotteryTwo.getLotteryRes().split(","));
                String[] oneArrayDifference = getDifferenceStringArray(lotteryOne.getLotteryRes().split(","));

                //根据当期的彩票结果 根据数组每个数所在 butValue所出现的先后顺序排序
                String[] threeArray = getSort(threeArrayDifference, butValue);
                String[] twoArray = getSort(twoArrayDifference,butValue);
                String[] oneArray = getSort(oneArrayDifference,butValue);


                String  three = threeArray[0];
                String  two = twoArray[0];
                String one = oneArray[0];

                String threeNum = h.get(three);
                String twoNum = h.get(two);
                String oneNum = h.get(one);
                if(startIndex == 0){
                    startIndex = 5;
                }
                char oneChar = oneNum.charAt(startIndex);
                char twoChar = twoNum.charAt(startIndex+1);
                char threeChar = threeNum.charAt(startIndex+2);
                startIndex--;
                // 拼接计算结果
                String dataStr =oneChar +""+twoChar+threeChar;
                if(args.getTypeFlag() == 1){
                    data.add(oneNum);
                }else{
                    data.add(dataStr);
                }
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryOne.getLotteryDate()+"-"+lotteryOne.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);
                colNum = startIndex;

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        // 将结果返回前端
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);
        plsResult.setColNum(colNum);
        return plsResult;
    }

    /**
     * 获取1-8差胆的数据  \12345
     * @return
     */
    @Override
    public PLSResult getOneAndEightDifferenceRollBack(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        //      RedisUtil.set(CommonConstants.PLS,list,60*60*24);
        List dateNum = null;
        List data = null;
        int  colNum = 0; //列数
        // 为了计算跨度必须提供105期数据

        String butValue=null;
        switch (args.getOption()){
            case 77:
                butValue = "1470369258";
                break;
            case 92:
                butValue = "8529630741";
                break;
        }
        if(ObjectUtils.isNotEmpty(list)){
            // 自组号码
            HashMap<String,String> h = new HashMap<>();
            h.put("0","7763877638");
            h.put("1","2874428744");
            h.put("2","8995989959");
            h.put("3","4056640566");
            h.put("4","9117191171");
            h.put("5","6288362883");
            h.put("6","1329513295");
            h.put("7","3400034000");
            h.put("8","5531755317");
            h.put("9","0642206422");

            dateNum = new ArrayList();
            data = new ArrayList();
            // 这两个值是用来获取前两期中的数使用的
            int threeIndex = 0;
            int twoIndex = 0;
            LotteryModel lotteryModel = list.get(2);
            String substring = lotteryModel.getLotteryNo().substring(2);
            //  起始位公式为   ((期数-5)%5)  6 11 16 0 = 6    6- x/5
            int va =  ((Integer.parseInt(substring)-5))%5;
            int startIndex = 0;
            if(va == 0){
                startIndex = 1;
            }else{
                startIndex = 9-(6-va);
            }
            startIndex = startIndex+args.getHundredOne(); // 这里计算得是百位 1 2 3 4 5
            if(startIndex>=10){
                startIndex = (startIndex-9)+4;
            }
            if(startIndex==0){
                startIndex = 5;
            }
            if(startIndex==1){
                startIndex = 6;
            }
            for (int i=2;i<list.size();i++){
                threeIndex = i-2;
                twoIndex = i-1;
                LotteryModel lotteryThree = list.get(threeIndex);
                LotteryModel lotteryTwo = list.get(twoIndex);
                LotteryModel lotteryOne = list.get(i);

                String[] threeArrayDifference = getDifferenceStringArray(lotteryThree.getLotteryRes().split(","));
                String[] twoArrayDifference = getDifferenceStringArray(lotteryTwo.getLotteryRes().split(","));
                String[] oneArrayDifference = getDifferenceStringArray(lotteryOne.getLotteryRes().split(","));

                //根据当期的彩票结果 根据数组每个数所在 butValue所出现的先后顺序排序
                String[] threeArray = getSort(threeArrayDifference, butValue);
                String[] twoArray = getSort(twoArrayDifference,butValue);
                String[] oneArray = getSort(oneArrayDifference,butValue);


                String  three = threeArray[0];
                String  two = twoArray[0];
                String one = oneArray[0];

                String threeNum = h.get(three);
                String twoNum = h.get(two);
                String oneNum = h.get(one);
                if(startIndex == 9){
                    startIndex = 4;
                }
                char oneChar = oneNum.charAt(startIndex);
                char twoChar = twoNum.charAt(startIndex-1);
                char threeChar = threeNum.charAt(startIndex-2);
                startIndex++;
                // 拼接计算结果
                String dataStr =threeChar +""+twoChar+oneChar;
                if(args.getTypeFlag() == 1){
                    data.add(oneNum);
                }else{
                    data.add(dataStr);
                }
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryOne.getLotteryDate()+"-"+lotteryOne.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);
                colNum = startIndex;

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        // 将结果返回前端
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);
        plsResult.setColNum(colNum);
        return plsResult;
    }

    /**
     * 获取3-7胆的数据  /12345
     * @return
     */
    @Override
    public PLSResult getThreeAndSevenDifference(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        //      RedisUtil.set(CommonConstants.PLS,list,60*60*24);
        List dateNum = null;
        List data = null;
        int  colNum = 0; //列数
        // 为了计算跨度必须提供105期数据

        String butValue=null;
        switch (args.getOption()){
            case 75:
                butValue = "3480159267";
                break;
            case 83:
                butValue = "7629510843";
                break;
        }
        if(ObjectUtils.isNotEmpty(list)){
            // 自组号码
            HashMap<String,String> h = new HashMap<>();
            h.put("0","7861278612");
            h.put("1","9075690756");
            h.put("2","2996429964");
            h.put("3","8754987549");
            h.put("4","4318143181");
            h.put("5","1189511895");
            h.put("6","6227062270");
            h.put("7","5603756037");
            h.put("8","0430304303");
            h.put("9","3542835428");

            dateNum = new ArrayList();
            data = new ArrayList();
            // 这两个值是用来获取前两期中的数使用的
            int threeIndex = 0;
            int twoIndex = 0;
            LotteryModel lotteryModel = list.get(2);
            String substring = lotteryModel.getLotteryNo().substring(2);
            //  起始位公式为   ((期数-5)%5)  6 11 16 0 = 6    6- x/5
            int va =  ((Integer.parseInt(substring)-5))%5;
            int startIndex = 0;
            if(va == 0){
                startIndex = 1;
            }else{
                startIndex = 6-va;
            }
            startIndex = startIndex+args.getHundredOne(); // 这里计算得是百位 1 2 3 4 5
            if(startIndex==8){
                startIndex = 3;
            }
            if(startIndex==9){
                startIndex = 4;
            }
            for (int i=2;i<list.size();i++){
                threeIndex = i-2;
                twoIndex = i-1;
                LotteryModel lotteryThree = list.get(threeIndex);
                LotteryModel lotteryTwo = list.get(twoIndex);
                LotteryModel lotteryOne = list.get(i);

                String[] threeArrayDifference = getDifferenceStringArray(lotteryThree.getLotteryRes().split(","));
                String[] twoArrayDifference = getDifferenceStringArray(lotteryTwo.getLotteryRes().split(","));
                String[] oneArrayDifference = getDifferenceStringArray(lotteryOne.getLotteryRes().split(","));

                //根据当期的彩票结果 根据数组每个数所在 butValue所出现的先后顺序排序
                String[] threeArray = getSort(threeArrayDifference, butValue);
                String[] twoArray = getSort(twoArrayDifference,butValue);
                String[] oneArray = getSort(oneArrayDifference,butValue);

                String  three = threeArray[0];
                String  two = twoArray[0];
                String one = oneArray[0];

                String threeNum = h.get(three);
                String twoNum = h.get(two);
                String oneNum = h.get(one);
                if(startIndex == 0){
                    startIndex = 5;
                }
                char oneChar = oneNum.charAt(startIndex);
                char twoChar = twoNum.charAt(startIndex+1);
                char threeChar = threeNum.charAt(startIndex+2);
                startIndex--;
                // 拼接计算结果
                String dataStr =oneChar +""+twoChar+threeChar;
                if(args.getTypeFlag() == 1){
                    data.add(oneNum);
                }else{
                    data.add(dataStr);
                }
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryOne.getLotteryDate()+"-"+lotteryOne.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);
                colNum = startIndex;

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        // 将结果返回前端
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);
        plsResult.setColNum(colNum);
        return plsResult;
    }

    /**
     * 获取3-7胆的数据  \12345
     * @return
     */
    @Override
    public PLSResult getThreeAndSevenDifferenceRollBack(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        //      RedisUtil.set(CommonConstants.PLS,list,60*60*24);
        List dateNum = null;
        List data = null;
        int  colNum = 0; //列数
        // 为了计算跨度必须提供105期数据

        String butValue=null;
        switch (args.getOption()){
            case 79:
                butValue = "3480159267";
                break;
            case 87:
                butValue = "7629510843";
                break;
        }
        if(ObjectUtils.isNotEmpty(list)){
            // 自组号码
            HashMap<String,String> h = new HashMap<>();
            h.put("0","7861278612");
            h.put("1","9075690756");
            h.put("2","2996429964");
            h.put("3","8754987549");
            h.put("4","4318143181");
            h.put("5","1189511895");
            h.put("6","6227062270");
            h.put("7","5603756037");
            h.put("8","0430304303");
            h.put("9","3542835428");

            dateNum = new ArrayList();
            data = new ArrayList();
            // 这两个值是用来获取前两期中的数使用的
            int threeIndex = 0;
            int twoIndex = 0;
            LotteryModel lotteryModel = list.get(2);
            String substring = lotteryModel.getLotteryNo().substring(2);
            //  起始位公式为   ((期数-5)%5)  6 11 16 0 = 6    6- x/5
            int va =  ((Integer.parseInt(substring)-5))%5;
            int startIndex = 0;
            if(va == 0){
                startIndex = 1;
            }else{
                startIndex = 9-(6-va);
            }
            startIndex = startIndex+args.getHundredOne(); // 这里计算得是百位 1 2 3 4 5
            if(startIndex>=10){
                startIndex = (startIndex-9)+4;
            }
            if(startIndex==0){
                startIndex = 5;
            }
            if(startIndex==1){
                startIndex = 6;
            }
            for (int i=2;i<list.size();i++){
                threeIndex = i-2;
                twoIndex = i-1;
                LotteryModel lotteryThree = list.get(threeIndex);
                LotteryModel lotteryTwo = list.get(twoIndex);
                LotteryModel lotteryOne = list.get(i);

                String[] threeArrayDifference = getDifferenceStringArray(lotteryThree.getLotteryRes().split(","));
                String[] twoArrayDifference = getDifferenceStringArray(lotteryTwo.getLotteryRes().split(","));
                String[] oneArrayDifference = getDifferenceStringArray(lotteryOne.getLotteryRes().split(","));

                //根据当期的彩票结果 根据数组每个数所在 butValue所出现的先后顺序排序
                String[] threeArray = getSort(threeArrayDifference, butValue);
                String[] twoArray = getSort(twoArrayDifference,butValue);
                String[] oneArray = getSort(oneArrayDifference,butValue);

                String  three = threeArray[0];
                String  two = twoArray[0];
                String one = oneArray[0];

                String threeNum = h.get(three);
                String twoNum = h.get(two);
                String oneNum = h.get(one);
                if(startIndex == 9){
                    startIndex = 4;
                }
                char oneChar = oneNum.charAt(startIndex);
                char twoChar = twoNum.charAt(startIndex-1);
                char threeChar = threeNum.charAt(startIndex-2);
                startIndex++;
                // 拼接计算结果
                String dataStr =threeChar +""+twoChar+oneChar;
                if(args.getTypeFlag() == 1){
                    data.add(oneNum);
                }else{
                    data.add(dataStr);
                }
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryOne.getLotteryDate()+"-"+lotteryOne.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);
                colNum = startIndex;

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        // 将结果返回前端
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);
        plsResult.setColNum(colNum);
        return plsResult;
    }

    /**
     * 获取5-6差胆的数据  /12345
     * @return
     */
    @Override
    public PLSResult getFiveAndSixDifference(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        //      RedisUtil.set(CommonConstants.PLS,list,60*60*24);
        List dateNum = null;
        List data = null;
        int  colNum = 0; //列数
        // 为了计算跨度必须提供105期数据

        String butValue=null;
        switch (args.getOption()){
            case 81:
                butValue = "5049382716";
                break;
            case 82:
                butValue = "6172839405";
                break;
        }
        if(ObjectUtils.isNotEmpty(list)){
            // 自组号码
            HashMap<String,String> h = new HashMap<>();
            h.put("0","6465864658");
            h.put("1","2677526775");
            h.put("2","3798037980");
            h.put("3","5859758597");
            h.put("4","0910209102");
            h.put("5","7086370863");
            h.put("6","1521415214");
            h.put("7","8102981029");
            h.put("8","4233642336");
            h.put("9","9344193441");

            dateNum = new ArrayList();
            data = new ArrayList();
            // 这两个值是用来获取前两期中的数使用的
            int threeIndex = 0;
            int twoIndex = 0;
            LotteryModel lotteryModel = list.get(2);
            String substring = lotteryModel.getLotteryNo().substring(2);
            //  起始位公式为   ((期数-5)%5)  6 11 16 0 = 6    6- x/5
            int va =  ((Integer.parseInt(substring)-5))%5;
            int startIndex = 0;
            if(va == 0){
                startIndex = 1;
            }else{
                startIndex = 6-va;
            }
            startIndex = startIndex+args.getHundredOne(); // 这里计算得是百位 1 2 3 4 5
            if(startIndex==8){
                startIndex = 3;
            }
            if(startIndex==9){
                startIndex = 4;
            }
            for (int i=2;i<list.size();i++){
                threeIndex = i-2;
                twoIndex = i-1;
                LotteryModel lotteryThree = list.get(threeIndex);
                LotteryModel lotteryTwo = list.get(twoIndex);
                LotteryModel lotteryOne = list.get(i);

                String[] threeArrayDifference = getDifferenceStringArray(lotteryThree.getLotteryRes().split(","));
                String[] twoArrayDifference = getDifferenceStringArray(lotteryTwo.getLotteryRes().split(","));
                String[] oneArrayDifference = getDifferenceStringArray(lotteryOne.getLotteryRes().split(","));

                //根据当期的彩票结果 根据数组每个数所在 butValue所出现的先后顺序排序
                String[] threeArray = getSort(threeArrayDifference, butValue);
                String[] twoArray = getSort(twoArrayDifference,butValue);
                String[] oneArray = getSort(oneArrayDifference,butValue);

                String  three = threeArray[0];
                String  two = twoArray[0];
                String one = oneArray[0];

                String threeNum = h.get(three);
                String twoNum = h.get(two);
                String oneNum = h.get(one);
                if(startIndex == 0){
                    startIndex = 5;
                }
                char oneChar = oneNum.charAt(startIndex);
                char twoChar = twoNum.charAt(startIndex+1);
                char threeChar = threeNum.charAt(startIndex+2);
                startIndex--;
                // 拼接计算结果
                String dataStr =oneChar +""+twoChar+threeChar;
                if(args.getTypeFlag() == 1){
                    data.add(oneNum);
                }else{
                    data.add(dataStr);
                }
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryOne.getLotteryDate()+"-"+lotteryOne.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);
                colNum = startIndex;

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        // 将结果返回前端
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);
        plsResult.setColNum(colNum);
        return plsResult;
    }

    /**
     * 获取5-6差胆的数据  \12345
     * @return
     */
    @Override
    public PLSResult getFiveAndSixDifferenceRollBack(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        //      RedisUtil.set(CommonConstants.PLS,list,60*60*24);
        List dateNum = null;
        List data = null;
        int  colNum = 0; //列数
        // 为了计算跨度必须提供105期数据

        String butValue=null;
        switch (args.getOption()){
            case 85:
                butValue = "5049382716";
                break;
            case 86:
                butValue = "6172839405";
                break;
        }
        if(ObjectUtils.isNotEmpty(list)){
            // 自组号码
            HashMap<String,String> h = new HashMap<>();
            h.put("0","6465864658");
            h.put("1","2677526775");
            h.put("2","3798037980");
            h.put("3","5859758597");
            h.put("4","0910209102");
            h.put("5","7086370863");
            h.put("6","1521415214");
            h.put("7","8102981029");
            h.put("8","4233642336");
            h.put("9","9344193441");

            dateNum = new ArrayList();
            data = new ArrayList();
            // 这两个值是用来获取前两期中的数使用的
            int threeIndex = 0;
            int twoIndex = 0;
            LotteryModel lotteryModel = list.get(2);
            String substring = lotteryModel.getLotteryNo().substring(2);
            //  起始位公式为   ((期数-5)%5)  6 11 16 0 = 6    6- x/5
            int va =  ((Integer.parseInt(substring)-5))%5;
            int startIndex = 0;
            if(va == 0){
                startIndex = 1;
            }else{
                startIndex = 9-(6-va);
            }
            startIndex = startIndex+args.getHundredOne(); // 这里计算得是百位 1 2 3 4 5
            if(startIndex>=10){
                startIndex = (startIndex-9)+4;
            }
            if(startIndex==0){
                startIndex = 5;
            }
            if(startIndex==1){
                startIndex = 6;
            }
            for (int i=2;i<list.size();i++){
                threeIndex = i-2;
                twoIndex = i-1;
                LotteryModel lotteryThree = list.get(threeIndex);
                LotteryModel lotteryTwo = list.get(twoIndex);
                LotteryModel lotteryOne = list.get(i);

                String[] threeArrayDifference = getDifferenceStringArray(lotteryThree.getLotteryRes().split(","));
                String[] twoArrayDifference = getDifferenceStringArray(lotteryTwo.getLotteryRes().split(","));
                String[] oneArrayDifference = getDifferenceStringArray(lotteryOne.getLotteryRes().split(","));

                //根据当期的彩票结果 根据数组每个数所在 butValue所出现的先后顺序排序
                String[] threeArray = getSort(threeArrayDifference, butValue);
                String[] twoArray = getSort(twoArrayDifference,butValue);
                String[] oneArray = getSort(oneArrayDifference,butValue);

                String  three = threeArray[0];
                String  two = twoArray[0];
                String one = oneArray[0];

                String threeNum = h.get(three);
                String twoNum = h.get(two);
                String oneNum = h.get(one);
                if(startIndex == 9){
                    startIndex = 4;
                }
                char oneChar = oneNum.charAt(startIndex);
                char twoChar = twoNum.charAt(startIndex-1);
                char threeChar = threeNum.charAt(startIndex-2);
                startIndex++;
                // 拼接计算结果
                String dataStr =threeChar +""+twoChar+oneChar;
                if(args.getTypeFlag() == 1){
                    data.add(oneNum);
                }else{
                    data.add(dataStr);
                }
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryOne.getLotteryDate()+"-"+lotteryOne.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);
                colNum = startIndex;

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        // 将结果返回前端
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);
        plsResult.setColNum(colNum);
        return plsResult;
    }

    /**
     * 获取4-2差胆的数据  /12345
     * @return
     */
    @Override
    public PLSResult getFourAndTwoDifference(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        //      RedisUtil.set(CommonConstants.PLS,list,60*60*24);
        List dateNum = null;
        List data = null;
        int  colNum = 0; //列数
        // 为了计算跨度必须提供105期数据

        String butValue=null;
        switch (args.getOption()){
            case 80:
                butValue = "4683579012";
                break;
            case 74:
                butValue = "2109753864";
                break;
        }
        if(ObjectUtils.isNotEmpty(list)){
            // 自组号码
            HashMap<String,String> h = new HashMap<>();
            h.put("0","4961549615");
            h.put("1","6072760727");
            h.put("2","1194811948");
            h.put("3","8855488554");
            h.put("4","3216932169");
            h.put("5","9387693876");
            h.put("6","5428054280");
            h.put("7","0509105091");
            h.put("8","7633276332");
            h.put("9","2740327403");

            dateNum = new ArrayList();
            data = new ArrayList();
            // 这两个值是用来获取前两期中的数使用的
            int threeIndex = 0;
            int twoIndex = 0;
            LotteryModel lotteryModel = list.get(2);
            String substring = lotteryModel.getLotteryNo().substring(2);
            //  起始位公式为   ((期数-5)%5)  6 11 16 0 = 6    6- x/5
            int va =  ((Integer.parseInt(substring)-5))%5;
            int startIndex = 0;
            if(va == 0){
                startIndex = 1;
            }else{
                startIndex = 6-va;
            }
            startIndex = startIndex+args.getHundredOne(); // 这里计算得是百位 1 2 3 4 5
            if(startIndex==8){
                startIndex = 3;
            }
            if(startIndex==9){
                startIndex = 4;
            }
            for (int i=2;i<list.size();i++){
                threeIndex = i-2;
                twoIndex = i-1;
                LotteryModel lotteryThree = list.get(threeIndex);
                LotteryModel lotteryTwo = list.get(twoIndex);
                LotteryModel lotteryOne = list.get(i);

                String[] threeArrayDifference = getDifferenceStringArray(lotteryThree.getLotteryRes().split(","));
                String[] twoArrayDifference = getDifferenceStringArray(lotteryTwo.getLotteryRes().split(","));
                String[] oneArrayDifference = getDifferenceStringArray(lotteryOne.getLotteryRes().split(","));

                //根据当期的彩票结果 根据数组每个数所在 butValue所出现的先后顺序排序
                String[] threeArray = getSort(threeArrayDifference, butValue);
                String[] twoArray = getSort(twoArrayDifference,butValue);
                String[] oneArray = getSort(oneArrayDifference,butValue);

                String  three = threeArray[0];
                String  two = twoArray[0];
                String one = oneArray[0];

                String threeNum = h.get(three);
                String twoNum = h.get(two);
                String oneNum = h.get(one);
                if(startIndex == 0){
                    startIndex = 5;
                }
                char oneChar = oneNum.charAt(startIndex);
                char twoChar = twoNum.charAt(startIndex+1);
                char threeChar = threeNum.charAt(startIndex+2);
                startIndex--;
                // 拼接计算结果
                String dataStr =oneChar +""+twoChar+threeChar;
                if(args.getTypeFlag() == 1){
                    data.add(oneNum);
                }else{
                    data.add(dataStr);
                }
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryOne.getLotteryDate()+"-"+lotteryOne.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);
                colNum = startIndex;

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        // 将结果返回前端
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);
        plsResult.setColNum(colNum);
        return plsResult;
    }

    /**
     * 获取4-2差胆的数据  \12345
     * @return
     */
    @Override
    public PLSResult getFourAndTwoDifferenceRollBack(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        //      RedisUtil.set(CommonConstants.PLS,list,60*60*24);
        List dateNum = null;
        List data = null;
        int  colNum = 0; //列数
        // 为了计算跨度必须提供105期数据

        String butValue=null;
        switch (args.getOption()){
            case 84:
                butValue = "4683579012";
                break;
            case 78:
                butValue = "2109753864";
                break;
        }
        if(ObjectUtils.isNotEmpty(list)){
            // 自组号码
            HashMap<String,String> h = new HashMap<>();
            h.put("0","4961549615");
            h.put("1","6072760727");
            h.put("2","1194811948");
            h.put("3","8855488554");
            h.put("4","3216932169");
            h.put("5","9387693876");
            h.put("6","5428054280");
            h.put("7","0509105091");
            h.put("8","7633276332");
            h.put("9","2740327403");

            dateNum = new ArrayList();
            data = new ArrayList();
            // 这两个值是用来获取前两期中的数使用的
            int threeIndex = 0;
            int twoIndex = 0;
            LotteryModel lotteryModel = list.get(2);
            String substring = lotteryModel.getLotteryNo().substring(2);
            //  起始位公式为   ((期数-5)%5)  6 11 16 0 = 6    6- x/5
            int va =  ((Integer.parseInt(substring)-5))%5;
            int startIndex = 0;
            if(va == 0){
                startIndex = 1;
            }else{
                startIndex = 9-(6-va);
            }
            startIndex = startIndex+args.getHundredOne(); // 这里计算得是百位 1 2 3 4 5
            if(startIndex>=10){
                startIndex = (startIndex-9)+4;
            }
            if(startIndex==0){
                startIndex = 5;
            }
            if(startIndex==1){
                startIndex = 6;
            }
            for (int i=2;i<list.size();i++){
                threeIndex = i-2;
                twoIndex = i-1;
                LotteryModel lotteryThree = list.get(threeIndex);
                LotteryModel lotteryTwo = list.get(twoIndex);
                LotteryModel lotteryOne = list.get(i);

                String[] threeArrayDifference = getDifferenceStringArray(lotteryThree.getLotteryRes().split(","));
                String[] twoArrayDifference = getDifferenceStringArray(lotteryTwo.getLotteryRes().split(","));
                String[] oneArrayDifference = getDifferenceStringArray(lotteryOne.getLotteryRes().split(","));

                //根据当期的彩票结果 根据数组每个数所在 butValue所出现的先后顺序排序
                String[] threeArray = getSort(threeArrayDifference, butValue);
                String[] twoArray = getSort(twoArrayDifference,butValue);
                String[] oneArray = getSort(oneArrayDifference,butValue);

                String  three = threeArray[0];
                String  two = twoArray[0];
                String one = oneArray[0];

                String threeNum = h.get(three);
                String twoNum = h.get(two);
                String oneNum = h.get(one);
                if(startIndex == 9){
                    startIndex = 4;
                }
                char oneChar = oneNum.charAt(startIndex);
                char twoChar = twoNum.charAt(startIndex-1);
                char threeChar = threeNum.charAt(startIndex-2);
                startIndex++;
                // 拼接计算结果
                String dataStr =threeChar +""+twoChar+oneChar;
                if(args.getTypeFlag() == 1){
                    data.add(oneNum);
                }else{
                    data.add(dataStr);
                }
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryOne.getLotteryDate()+"-"+lotteryOne.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);
                colNum = startIndex;

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        // 将结果返回前端
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);
        plsResult.setColNum(colNum);
        return plsResult;
    }

    /**
     * 获取0-9差胆的数据  /12345
     * @return
     */
    @Override
    public PLSResult getZeroAndNineDifference(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        //      RedisUtil.set(CommonConstants.PLS,list,60*60*24);
        List dateNum = null;
        List data = null;
        int  colNum = 0; //列数
        // 为了计算跨度必须提供105期数据

        String butValue=null;
        switch (args.getOption()){
            case 72:
                butValue = "0123456789";
                break;
            case 89:
                butValue = "9876543210";
                break;
        }
        if(ObjectUtils.isNotEmpty(list)){
            // 自组号码
            HashMap<String,String> h = new HashMap<>();
            h.put("0","9961599615");
            h.put("1","6072060720");
            h.put("2","1193711937");
            h.put("3","3254232542");
            h.put("4","5315853158");
            h.put("5","0486404864");
            h.put("6","7527975279");
            h.put("7","2608626086");
            h.put("8","8739187391");
            h.put("9","4840348403");

            dateNum = new ArrayList();
            data = new ArrayList();
            // 这两个值是用来获取前两期中的数使用的
            int threeIndex = 0;
            int twoIndex = 0;
            LotteryModel lotteryModel = list.get(2);
            String substring = lotteryModel.getLotteryNo().substring(2);
            //  起始位公式为   ((期数-5)%5)  6 11 16 0 = 6    6- x/5
            int va =  ((Integer.parseInt(substring)-5))%5;
            int startIndex = 0;
            if(va == 0){
                startIndex = 1;
            }else{
                startIndex = 6-va;
            }
            startIndex = startIndex+args.getHundredOne(); // 这里计算得是百位 1 2 3 4 5
            if(startIndex==8){
                startIndex = 3;
            }
            if(startIndex==9){
                startIndex = 4;
            }
            for (int i=2;i<list.size();i++){
                threeIndex = i-2;
                twoIndex = i-1;
                LotteryModel lotteryThree = list.get(threeIndex);
                LotteryModel lotteryTwo = list.get(twoIndex);
                LotteryModel lotteryOne = list.get(i);

                String[] threeArrayDifference = getDifferenceStringArray(lotteryThree.getLotteryRes().split(","));
                String[] twoArrayDifference = getDifferenceStringArray(lotteryTwo.getLotteryRes().split(","));
                String[] oneArrayDifference = getDifferenceStringArray(lotteryOne.getLotteryRes().split(","));

                //根据当期的彩票结果 根据数组每个数所在 butValue所出现的先后顺序排序
                String[] threeArray = getSort(threeArrayDifference, butValue);
                String[] twoArray = getSort(twoArrayDifference,butValue);
                String[] oneArray = getSort(oneArrayDifference,butValue);

                String  three = threeArray[0];
                String  two = twoArray[0];
                String one = oneArray[0];

                String threeNum = h.get(three);
                String twoNum = h.get(two);
                String oneNum = h.get(one);
                if(startIndex == 0){
                    startIndex = 5;
                }
                char oneChar = oneNum.charAt(startIndex);
                char twoChar = twoNum.charAt(startIndex+1);
                char threeChar = threeNum.charAt(startIndex+2);
                startIndex--;
                // 拼接计算结果
                String dataStr =oneChar +""+twoChar+threeChar;
                if(args.getTypeFlag() == 1){
                    data.add(oneNum);
                }else{
                    data.add(dataStr);
                }
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryOne.getLotteryDate()+"-"+lotteryOne.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);
                colNum = startIndex;

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        // 将结果返回前端
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);
        plsResult.setColNum(colNum);
        return plsResult;
    }

    /**
     * 获取0-9差胆的数据  \12345
     * @return
     */
    @Override
    public PLSResult getZeroAndNineDifferenceRollBack(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        //      RedisUtil.set(CommonConstants.PLS,list,60*60*24);
        List dateNum = null;
        List data = null;
        int  colNum = 0; //列数
        // 为了计算跨度必须提供105期数据

        String butValue=null;
        switch (args.getOption()){
            case 76:
                butValue = "0123456789";
                break;
            case 93:
                butValue = "9876543210";
                break;
        }
        if(ObjectUtils.isNotEmpty(list)){
            // 自组号码
            HashMap<String,String> h = new HashMap<>();
            h.put("0","9961599615");
            h.put("1","6072060720");
            h.put("2","1193711937");
            h.put("3","3254232542");
            h.put("4","5315853158");
            h.put("5","0486404864");
            h.put("6","7527975279");
            h.put("7","2608626086");
            h.put("8","8739187391");
            h.put("9","4840348403");

            dateNum = new ArrayList();
            data = new ArrayList();
            // 这两个值是用来获取前两期中的数使用的
            int threeIndex = 0;
            int twoIndex = 0;
            LotteryModel lotteryModel = list.get(2);
            String substring = lotteryModel.getLotteryNo().substring(2);
            //  起始位公式为   ((期数-5)%5)  6 11 16 0 = 6    6- x/5
            int va =  ((Integer.parseInt(substring)-5))%5;
            int startIndex = 0;
            if(va == 0){
                startIndex = 1;
            }else{
                startIndex = 9-(6-va);
            }
            startIndex = startIndex+args.getHundredOne(); // 这里计算得是百位 1 2 3 4 5
            if(startIndex>=10){
                startIndex = (startIndex-9)+4;
            }
            if(startIndex==0){
                startIndex = 5;
            }
            if(startIndex==1){
                startIndex = 6;
            }
            for (int i=2;i<list.size();i++){
                threeIndex = i-2;
                twoIndex = i-1;
                LotteryModel lotteryThree = list.get(threeIndex);
                LotteryModel lotteryTwo = list.get(twoIndex);
                LotteryModel lotteryOne = list.get(i);

                String[] threeArrayDifference = getDifferenceStringArray(lotteryThree.getLotteryRes().split(","));
                String[] twoArrayDifference = getDifferenceStringArray(lotteryTwo.getLotteryRes().split(","));
                String[] oneArrayDifference = getDifferenceStringArray(lotteryOne.getLotteryRes().split(","));

                //根据当期的彩票结果 根据数组每个数所在 butValue所出现的先后顺序排序
                String[] threeArray = getSort(threeArrayDifference, butValue);
                String[] twoArray = getSort(twoArrayDifference,butValue);
                String[] oneArray = getSort(oneArrayDifference,butValue);

                String  three = threeArray[0];
                String  two = twoArray[0];
                String one = oneArray[0];

                String threeNum = h.get(three);
                String twoNum = h.get(two);
                String oneNum = h.get(one);
                if(startIndex == 9){
                    startIndex = 4;
                }
                char oneChar = oneNum.charAt(startIndex);
                char twoChar = twoNum.charAt(startIndex-1);
                char threeChar = threeNum.charAt(startIndex-2);
                startIndex++;
                // 拼接计算结果
                String dataStr =threeChar +""+twoChar+oneChar;
                if(args.getTypeFlag() == 1){
                    data.add(oneNum);
                }else{
                    data.add(dataStr);
                }
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryOne.getLotteryDate()+"-"+lotteryOne.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);
                colNum = startIndex;

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        // 将结果返回前端
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);
        plsResult.setColNum(colNum);
        return plsResult;
    }

    /**
     * @Author 李中博、张博童
     * @Description
     * @Date 2024/9/18 15:52
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param args 百位十位个位差  按钮 数列数据组合 /12345
     */
    @Override
    public PLSResult getLotteryHTPDifference(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        List data = null;
        List dateNum=null;
        if(ObjectUtils.isNotEmpty(list)){
            data = new ArrayList();
            dateNum = new ArrayList();
            for (int i=2;i<list.size();i++){
                LotteryModel lotteryModel = list.get(i);
                String lotteryRes = lotteryModel.getLotteryRes();
                String result = lotteryRes.replace(",", "");
                // 拼接计算结果
                String dataStr =result.substring(0,3);
                String[] array = dataStr.split("");

                data.add(String.join("",getDifferenceStringArray(array)));
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryModel.getLotteryDate()+"-"+lotteryModel.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);

        return plsResult;
    }

    /**
     * @Author 李中博、张博童
     * @Description
     * @Date 2024/9/18 15:52
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param args 百位十位个位和  按钮 数列数据组合
     */
    @Override
    public PLSResult getLotteryHTPSum(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        List data = null;
        List dateNum=null;
        if(ObjectUtils.isNotEmpty(list)){
            data = new ArrayList();
            dateNum = new ArrayList();
            for (int i=2;i<list.size();i++){
                LotteryModel lotteryModel = list.get(i);
                String lotteryRes = lotteryModel.getLotteryRes();
                String result = lotteryRes.replace(",", "");
                // 拼接计算结果
                String dataStr =result.substring(0,3);
                String[] array = dataStr.split("");

                data.add(String.join("",getSumStringArray(array)));
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryModel.getLotteryDate()+"-"+lotteryModel.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);

        return plsResult;
    }

    /**
     * @Author 李中博、张博童
     * @Description
     * @Date 2024/9/18 15:52
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param args 小中大  按钮 数列数据组合
     */
    @Override
    public PLSResult getLotteryHTPOrderBy(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        List data = null;
        List dateNum=null;
        if(ObjectUtils.isNotEmpty(list)){
            data = new ArrayList();
            dateNum = new ArrayList();
            for (int i=2;i<list.size();i++){
                LotteryModel lotteryModel = list.get(i);
                String lotteryRes = lotteryModel.getLotteryRes();
                String result = lotteryRes.replace(",", "");
                // 拼接计算结果
                String dataStr =result.substring(0,3);
                String[] array = dataStr.split("");

                data.add(String.join("",getArrayOrderBy(String.join(",",array))));
                if(i<=4){
                    continue;
                }

                // 拼接期号数据
                String dateStr = lotteryModel.getLotteryDate()+"-"+lotteryModel.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);

        return plsResult;
    }

    /**
     * @Author 李中博、张博童
     * @Description
     * @Date 2024/9/18 15:52
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param args 小中大差  按钮 数列数据组合
     */
    @Override
    public PLSResult getLotteryHTPOrderByDifference(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        List data = null;
        List dateNum=null;
        if(ObjectUtils.isNotEmpty(list)){
            data = new ArrayList();
            dateNum = new ArrayList();
            for (int i=2;i<list.size();i++){
                LotteryModel lotteryModel = list.get(i);
                String lotteryRes = lotteryModel.getLotteryRes();
                String result = lotteryRes.replace(",", "");
                // 拼接计算结果
                String dataStr =result.substring(0,3);
                String[] array = dataStr.split("");
                String[] arrayOrderBy = getArrayOrderBy(String.join(",", array));
                data.add(String.join("",getDifferenceStringArray(arrayOrderBy)));
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryModel.getLotteryDate()+"-"+lotteryModel.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);

        return plsResult;
    }

    /**
     * @Author 李中博、张博童
     * @Description
     * @Date 2024/9/18 15:52
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param args 大中小和  按钮 数列数据组合
     */
    @Override
    public PLSResult getLotteryHTPOrderBySum(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        List data = null;
        List dateNum=null;
        if(ObjectUtils.isNotEmpty(list)){
            data = new ArrayList();
            dateNum = new ArrayList();
            for (int i=2;i<list.size();i++){
                LotteryModel lotteryModel = list.get(i);
                String lotteryRes = lotteryModel.getLotteryRes();
                String result = lotteryRes.replace(",", "");
                // 拼接计算结果
                String dataStr =result.substring(0,3);
                String[] array = dataStr.split("");
                String[] arrayOrderBy = getArrayOrderBy(String.join(",", array));
                //Arrays.sort(arrayOrderBy,Comparator.reverseOrder());
                data.add(String.join("",getSumStringArray(arrayOrderBy)));
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryModel.getLotteryDate()+"-"+lotteryModel.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);

        return plsResult;
    }

    /*
    * @Author 李中博
    * @Description 振幅差
    * @Date 2024/9/20 17:10
    * @Return com.zhuiyun.project.api.lottery.entity.PLSResult
    * @param args
    */
    @Override
    public PLSResult getLotteryHTPOrderByAmplitudeDifference(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        List data = null;
        List dateNum=null;
        if(ObjectUtils.isNotEmpty(list)){
            data = new ArrayList();
            dateNum = new ArrayList();
            for (int i=2;i<list.size();i++){
                LotteryModel lotteryModel = list.get(i);
                String lotteryRes = lotteryModel.getLotteryRes();
                String result = lotteryRes.replace(",", "");

                LotteryModel flotteryModel = list.get(i-1);
                String flotteryRes = flotteryModel.getLotteryRes();
                String fresult = flotteryRes.replace(",", "");

                // 拼接计算结果
                String dataStr =result.substring(0,3);
                String[] array = getDifferenceAmplitudeStringArray(result.split(""), fresult.split(""));

                data.add(String.join("",array));
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryModel.getLotteryDate()+"-"+lotteryModel.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);

        return plsResult;
    }

    /*
     * @Author 李中博
     * @Description 振幅和
     * @Date 2024/9/20 17:10
     * @Return com.zhuiyun.project.api.lottery.entity.PLSResult
     * @param args
     */
    @Override
    public PLSResult getLotteryHTPOrderByAmplitudeSum(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        List data = null;
        List dateNum=null;
        if(ObjectUtils.isNotEmpty(list)){
            data = new ArrayList();
            dateNum = new ArrayList();
            for (int i=2;i<list.size();i++){
                LotteryModel lotteryModel = list.get(i);
                String lotteryRes = lotteryModel.getLotteryRes();
                String result = lotteryRes.replace(",", "");

                LotteryModel flotteryModel = list.get(i-1);
                String flotteryRes = flotteryModel.getLotteryRes();
                String fresult = flotteryRes.replace(",", "");

                // 拼接计算结果
                String dataStr =result.substring(0,3);
                String[] array = getSmAmplitudeStringArray(result.split(""), fresult.split(""));

                data.add(String.join("",array));
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryModel.getLotteryDate()+"-"+lotteryModel.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);

        return plsResult;
    }

    /**
     * @Author 李中博、张博童
     * @Description
     * @Date 2024/9/18 15:52
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param args 和尾
     */
    @Override
    public PLSResult getLotteryHTPAndTails(Args args) {
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        List data = null;
        List dateNum=null;
        if(ObjectUtils.isNotEmpty(list)){
            data = new ArrayList();
            dateNum = new ArrayList();
            for (int i=2;i<list.size();i++){
                LotteryModel lotteryModel = list.get(i);
                String lotteryRes = lotteryModel.getLotteryRes();
                String result = lotteryRes.replace(",", "");
                // 拼接计算结果
                String dataStr =result.substring(0,3);
                String[] array = dataStr.split("");
                Integer sum= (Integer.parseInt(array[0])+Integer.parseInt(array[1])+Integer.parseInt(array[2]))%10;
                array[0]=sum.toString();
                array[1]=sum.toString();
                array[2]=sum.toString();
                data.add(String.join("",array));
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryModel.getLotteryDate()+"-"+lotteryModel.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);

        return plsResult;
    }

    /**
     * @Author 李中博、张博童
     * @Description
     * @Date 2024/9/18 15:52
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param args 号码组合形态
     */
    public PLSResult getNumberCombination(Args args){
        List<LotteryModel> list = null;
        String[] NArray = {"113","131","311","123","132","213","333","231","312",
                           "321","133","313","331"};
        List<String> NArrayList = Arrays.asList(NArray);
        setCount(args);
        list = lotteryMapper.select105data(args);
        List data = null;
        List dateNum=null;
        if(ObjectUtils.isNotEmpty(list)){
            data = new ArrayList();
            dateNum = new ArrayList();
            for (int i=2;i<list.size();i++){
                LotteryModel lotteryModel = list.get(i);
                String lotteryRes = lotteryModel.getLotteryRes();
                String result = lotteryRes.replace(",", "");
                // 拼接计算结果
                String dataStr =result.substring(0,3);
                String[] array = dataStr.split("");

                String combination = getCombination(array);
                int num = NArrayList.indexOf(combination);
                data.add(num+"");
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryModel.getLotteryDate()+"-"+lotteryModel.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setColNum(6);
        plsResult.setDateNumData(dateNum);
        return plsResult;
    }

    /**
     * @Author 李中博、张博童
     * @Description
     * @Date 2024/9/18 15:52
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param args 单选间隔
     */
    @Override
    public PLSResult getSingleChoiceInterval(Args args){
        List<LotteryModel> list = null;
        setCount(args);
        list = lotteryMapper.select105data(args);
        List data = null;
        List dateNum=null;
        if(ObjectUtils.isNotEmpty(list)){
            data = new ArrayList();
            dateNum = new ArrayList();
            for (int i=2;i<list.size();i++){
                LotteryModel lotteryModel = list.get(i);
                String lotteryRes = lotteryModel.getLotteryRes();
                String result = lotteryRes.replace(",", "");
                // 拼接计算结果
                String dataStr =result.substring(0,3);
                String[] single = getSingle(dataStr.split(""));
                data.add(String.join("",single));
                if(i<=4){
                    continue;
                }
                // 拼接期号数据
                String dateStr = lotteryModel.getLotteryDate()+"-"+lotteryModel.getLotteryNo().substring(2)+"-"+dataStr;
                dateNum.add(dateStr);

            }
        }else{
            // 如果数据为空则同步数据
            asyncLotteryData.async();
        }
        PLSResult plsResult = new PLSResult();
        plsResult.setData(data);
        plsResult.setDateNumData(dateNum);

        return plsResult;
    }

    @Override
    public int getNewLottery() {
        int count = lotteryMapper.getNewLottery();
        return count;
    }


    /*
    * @Author 李中博
    * @Description 求三位数的 /百十差，/十个差，/百个差祖成的数组（绝对值）
    * @Return String[]
    * @param String array
    */
    public String[] getDifferenceStringArray(String[] arrayOrderBy){
            //获取百位 十位 个位
            Integer hundred=Integer.parseInt(arrayOrderBy[0]);
            Integer ten=Integer.parseInt(arrayOrderBy[1]);
            Integer piece=Integer.parseInt(arrayOrderBy[2]);
            //求百十差 十个差 百个差 的绝对值
            Integer hundredAndTen = Math.abs(hundred - ten);
            Integer tenAndPiece = Math.abs(ten-piece);
            Integer hundredAndPiece = Math.abs(hundred - piece);
            String[] returnArray= {hundredAndTen.toString(),tenAndPiece.toString(),hundredAndPiece.toString()};
            return returnArray;
    }
    /*
     * @Author 李中博
     * @Description 求三位数的 /百十和，/十个和，/百个和祖成的数组（绝对值）
     * @Return String[]
     * @param String array
     */
    public String[] getSumStringArray(String[] arrayOrderBy){
            //获取百位 十位 个位
            Integer hundred=Integer.parseInt(arrayOrderBy[0]);
            Integer ten=Integer.parseInt(arrayOrderBy[1]);
            Integer piece=Integer.parseInt(arrayOrderBy[2]);
            //求百十和 十个和 百个和 大于十取余
            Integer hundredAndTen = Math.abs(hundred + ten)%10;
            Integer tenAndPiece = Math.abs(ten+piece)%10;
            Integer hundredAndPiece = Math.abs(hundred + piece)%10;
            String[] returnArray= {hundredAndTen.toString(),tenAndPiece.toString(),hundredAndPiece.toString()};
            return returnArray;
    }

    /*
     * @Author 李中博
     * @Description 将字符串数组进行排序
     * @Return String[]
     * @param String array
     */
    public String[] getArrayOrderBy(String array){
        //将字符串分割成三位数的数组
        array = array.substring(0,5);
        String[] split = array.split(",");
        //动态排序
        Arrays.sort(split);
        return split;
    }

    /*
     * @Author 李中博
     * @Description
     * @Return String[]
     * @param String array,String butValue
     */
    public String[] getSort(String[] split,String butValue){

        //将字符串数组转换成三位数的字符串数组
        String[] result = new String[3];
        System.arraycopy(split, 0, result, 0, 3);
        //根据字符串数组的三个值 在butValue中所出现的先后顺序进行排序
        Arrays.sort(result, Comparator.comparingInt(s -> butValue.indexOf(s)));

        return result;
    }

    /*
     * @Author 李中博
     * @Description 求两个长度一致数组的每个对应值互减（取绝对值）组成的数组
     * @Return String[]
     * @param String array
     */
    public String[] getDifferenceAmplitudeStringArray(String[] array,String[] farray){
        //获取两个数组的各个值
        Integer hundred=Integer.parseInt(array[0]);
        Integer ten=Integer.parseInt(array[1]);
        Integer piece=Integer.parseInt(array[2]);

        Integer fhundred=Integer.parseInt(farray[0]);
        Integer ften=Integer.parseInt(farray[1]);
        Integer fpiece=Integer.parseInt(farray[2]);
        //求两个数组的各个值对应的差
        Integer one = Math.abs(hundred - fhundred);
        Integer two = Math.abs(ten-ften);
        Integer three = Math.abs(piece - fpiece);

        String[] returnArray= {one.toString(),two.toString(),three.toString()};
        return returnArray;
    }
    /*
     * @Author 李中博
     * @Description 求两个长度一致数组的每个对应值互加 大于10取余组成的数组
     * @Return String[]
     * @param String array
     */
    public String[] getSmAmplitudeStringArray(String[] array,String[] farray){
        //获取百位 十位 个位
        Integer hundred=Integer.parseInt(array[0]);
        Integer ten=Integer.parseInt(array[1]);
        Integer piece=Integer.parseInt(array[2]);

        Integer fhundred=Integer.parseInt(farray[0]);
        Integer ften=Integer.parseInt(farray[1]);
        Integer fpiece=Integer.parseInt(farray[2]);
        //求百十和 十个和 百个和 大于十取余
        Integer one = Math.abs(hundred + fhundred)%10;
        Integer two = Math.abs(ten+ften)%10;
        Integer three = Math.abs(piece + fpiece)%10;
        String[] returnArray= {one.toString(),two.toString(),three.toString()};
        return returnArray;
    }


    /*
     * @Author 李中博
     * @Description 号码组合形态
     * @Return String[]
     * @param String array
     */
    public  String  getCombination(String[] array){

        int[] a={Integer.parseInt(array[0]),Integer.parseInt(array[1]),Integer.parseInt(array[2])};
        int one = a[0];
        int two = a[1];
        int three = a[2];

        int b= one-two;
        int c=one-three;
        int d= two-three;

        if (b==0){
            if (d>0){
                return "331";
            }else if(d<0){
                return "113";
            }
        }
        if (c==0){
            if (b>0){
                return "313";
            }else if(b<0) {
                return "131";
            }
        }
        if (d==0){
            if (b>0){
                return "311";
            }else if(b<0){
                return "133";
            }
        }
        if (b>0&&c>0){
            if (d>0){
                return"321";
            }else {
                return"312";
            }
        }else if(b<0&&c>0){
            return"231";
        }else if (b<0&&c<0){
            if (d>0){
                return "132";
            }else {
                return"123";
            }
        }else  if (b>0&&c<0){
            return"213";
        }
        else {
            return "333";
        }
    }

    /*
     * @Author 李中博
     * @Description 求三位数的 /百十差，/十个差，/百个差祖成的数组（绝对值）
     * @Return String[]
     * @param String array
     */
    public String[] getSingle(String[] arrayOrderBy){
        //获取百位 十位 个位
        Integer hundred=Integer.parseInt(arrayOrderBy[0]);
        Integer ten=Integer.parseInt(arrayOrderBy[1]);
        Integer piece=Integer.parseInt(arrayOrderBy[2]);


        //求百十差 十个差 百个差 的绝对值
        Integer hundredAndTen = Math.abs(9-hundred+ten)%10;
        Integer tenAndPiece = Math.abs(9-ten+piece)%10;
        Integer hundredAndPiece = Math.abs(9 -hundred + piece)%10;
        String[] returnArray= {hundredAndTen.toString(),tenAndPiece.toString(),hundredAndPiece.toString()};
        return returnArray;
    }

}
